Definition of a linear table:
A linear table is a linear structure, it is a finite sequence containing n≥0 nodes, in which nodes have and only one starting node (the first element) has no precursor but there is a successor node, and there is only one terminal node (last nodes) without successor but there is a precursor node, All other nodes have and have only one precursor and one successor node. Generally, a linear table can be expressed as a linear sequence: K1,k2,..., kn, where K1 is the starting node and the KN is the terminal node.
The above definition can be remembered with the following image
A pair of ordered sequences (A,b,c,............ Z)
Figure is shown as
(^,a (First node, there is no precursor but there is a successor node), B,c ... (All other nodes have and have only one precursor and one successor node) ... Z (last node, no successor but there is a precursor node), ^)
Summary: All conforming to the characteristics of the above diagram can be considered as linear table.
The difference between the sequential representation of linear table and the expression of chain
Order table
The storage diagram is as follows
Characteristics:
One, logically adjacent data elements, physical storage location is also adjacent. (Logos consistent)
Second, the storage space of the sequential table needs to be allocated beforehand.
Advantages:
(1) The method is simple, each kind of high-level language has the array, easy to realize. (Language versatility)
(2) There is no need to add additional storage overhead to represent the logical relationship between nodes. (Memory Savings)
(3) Sequential table has the characteristic of random access by element ordinal number. (Logos consistency)
Disadvantages:
(1) when inserting and deleting in the order table, the average moving table is half of the elements, so it is inefficient for n large order table. (Operation low Efficiency)
(2) The need to allocate large enough storage space, the estimate is too large, may lead to a large number of sequential table idle, the advance allocation is too small, and will cause overflow. (Memory retention)
Chained table
The storage diagram is as follows