There are two ways to implement linear tables, namely: 1. Sequential storage structure, the storage space occupied by its elements is continuous and stored in logical order; 2. Chain storage structure, it can A discontinuous set of arbitrary storage units, with two parts of storage, one part stores the data field of the data element value, and the other part stores the pointer field of the direct predecessor or direct successor node.
Linear tables have two basic storage structures: Sequential storage structure and chained storage structure.
1. Sequential table
has the following two basic characteristics:
(1) The storage occupied by all elements of the linear table Space is continuous.
(2) Each data element in the linear table is stored in logical order in the storage space.
2. Linked storage of linear tables
Linked storage of linear tables The structure is to use a set of arbitrary storage units (which can be discontinuous) to store the data elements of the linear table.
For each data element in the linear table, two parts are needed to store: one part is used to store the data element value, called the data field; the other part is used to store the direct predecessor or direct successor node. The address (pointer) is called the pointer field, and this storage unit is called a node.
3. Circular Linked List
Circular Linked List (Circular Linked List) is another form of linked storage structure. It points the pointer of the last node in the singly linked list to the head node of the linked list, connecting the entire linked list head to tail to form a ring.
4. Doubly linked list
A two-way linked list uses two pointers to represent the logical relationship between nodes. That is, a pointer field pointing to its immediate predecessor is added. The linked list thus formed has two chains in different directions, the predecessor and the successor, so it is called a doubly linked list.
typedef struct DNode{ ElemType data; struct DNode *prior; struct DNode *next; }Dnode,*DuLinkList;
5. Definition form in actual use
related Learning recommendations: PHP programming from entry to proficiency
The above is the detailed content of How many ways can a linear table be implemented?. For more information, please follow other related articles on the PHP Chinese website!