Linear tables can be divided:
Ordered linear table: An array is used as the storage structure, and logically adjacent elements are also adjacent to physical storage. You can randomly access any element based on the index. However, operations on the element must be performed on all subsequent elements of the element.
Single-chain table: each element is random on physical storage. Except the last element, each element points to its successor element through a pointer. Access to an element must start with the first element and be directed by the pointer to the element in sequence. Insert and delete operations on elements are highly efficient. You only need to modify the corresponding pointer.
Static linked list: the index of the next element is represented by the following table of data items in the previous element of the logical relationship. The storage structure is stored in arrays. Prepare an array for use in advance. If no element is added, an array element is obtained.
Two-way linked list:
Cyclic linked list:
Algorithm code implementation:
Linear table implementation:
Array and linked list
Int array [];
Linear table operations:
Insert, delete, search, and sort.
Special linear table:
STACK:
Stack operations:
Stack implementation:
Queue:
Queue operations:
Queue implementation:
Application of various linear tables