Third speaking. Linear table (reading notes)

Source: Internet
Author: User

A. Linear table (list) concept

Linear table (list): A finite sequence of 0 or more data elements.

Elements are ordered, and if there are multiple elements, the first element has no precursor, the last element has no successor, and every other element has only one precursor and successor.

Two. Abstract data types for linear tables

For a linear table, inserting the data and deleting the data are all necessary operations.

Note A very confusing place: when you pass a parameter to a function, the parameter will not be altered within the function to determine what parameter form to use. If the need to be changed, you need to pass a pointer to this parameter, if not changed, you can pass this parameter directly.

Three. Sequential storage structure for linear tables

Sequential storage structure of linear tables, which refers to the data elements of a linear table stored sequentially by a storage unit with successive addresses.

We found that the description of the sequential storage structure requires three attributes:

1> The starting position of the storage space: array data, where storage space is stored.
2>: Maximum storage capacity of a linear table-array length maxsize.
3> current length of linear table: length

It is important to note that the length of the array is the length of the storage space for the linear table, and this amount is generally constant after storage allocation.

The length of the linear table is the number of data elements in the linear table, which varies with the linear table insertion and deletion operations.
At any given moment, the length of the linear table should be less than or equal to the length of the array.

Four. Address calculation method

Storing the sequential table with an array means allocating a fixed-length array space, since the array space allocated is greater than or equal to the length of the current linear table because the insert and delete operations are possible in the linear table.

We often refer to a storage structure with this characteristic as a random access structure.

Third speaking. Linear table (reading notes)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.