Data structure study notes --- linear table (1)

1. Regarding linear tables, the storage structures we often come into contact with include sequential storage and chain storage. The addresses of the sequential storage structure are continuous (that is, a continuous storage space must be occupied), so random access can be realized by calculating the address. The storage addresses of the linked storage structure are not necessarily continuous, and can only be accessed sequentially through the pointers of each node. When using a sequential storage structure, inserting and deleting elements requires moving a large number of elements, which is not convenient for inserting and deleting operations. The chain storage structure is used to facilitate insertion and deletion operations, but the search can only be performed sequentially, and the time complexity is O(n).

2. The data elements in the linear table have abstract (that is, indeterminate) data types, which can be different types such as numbers, characters, records, etc. When designing a specific application program, the abstract type of the data element will be determined by the specific data type replace.
The number of data elements contained in the linear table is not arbitrary and must be limited.
In a non-empty table L=(a 1 , a 2 ,…an ), there is an ordinal relationship between any pair of adjacent data elements a i-1 and ai (1<i≦n) (a i -1 ,ai ), and a i-1 is called the predecessor of ai, and ai is called the successor of a i-1. In this sequence, a 1 has no predecessor, an has no successor, and every other element has one and only one predecessor and one successor. If it is an empty list, or there is only one element in the list, then the element has no direct predecessor node and no direct successor node.

3. The sequential storage structure and the chained storage structure of the linear table have their own advantages and disadvantages, and it cannot be said that one structure is definitely better than the other. Sequential storage is easy to find, but not conducive to frequent insertion and deletion. The linked storage structure of the linear table is convenient for insertion and deletion, and is suitable for frequent insertion/deletion of data elements.

 

Guess you like

Origin blog.csdn.net/qiaoqi17/article/details/108004496