Chapter 3 Linear Table

Linear table

Linear table: a finite sequence of zero or more data elements.

Sequential storage structure

The sequential storage structure of the linear table: refers to the sequential storage of data elements of the linear table with a section of storage units with consecutive addresses.

Chain storage structure

1. Single linked list

Head pointer: The head pointer refers to the pointer to the first node of the linked list. If the linked list has a head node, it is a pointer to the head node. No matter whether the linked list is empty or not, the head pointer is not empty. The head pointer is the linked list. Necessary element
head node: The head node is not a necessary element of the linked list. The head node is set up for the unity and convenience of operation. It is placed before the node of the first element, and its data field is generally meaningless (it can also store the linked list length).

2. Static linked list

The static linked list is actually designed for a high-level language without a pointer to achieve the ability of a single linked list.

3. Circular linked list

The pointer end of the last element of the singly linked list is changed from a null pointer to the head node, and the linked list forms a ring.

4. Doubly linked list

In fact, there is an element with two pointer fields, one pointing to the front and one pointing to the back

Performance comparison

Insert picture description here
Supplement: The special order for the access of the sequence table is: random access, and the access feature of the singly linked list is sequential access.
**Random access: **When the message in the memory is read or written, it is required The time is independent of the location of this piece of information.
**Sequential access: **Reading or writing is related to the location.

Guess you like

Origin blog.csdn.net/mogbox/article/details/109156432