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)