Home  >  Article  >  How many ways can a linear table be implemented?

How many ways can a linear table be implemented?

coldplay.xixi
coldplay.xixiOriginal
2020-06-29 10:12:464917browse

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.

How many ways can a linear table be implemented?

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.

How many ways can a linear table be implemented?

How many ways can a linear table be implemented?

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.

How many ways can a linear table be implemented?

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.

How many ways can a linear table be implemented?

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;

How many ways can a linear table be implemented?

5. Definition form in actual use

How many ways can a linear table be implemented?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn