Article Directory
1 Introduction
The previous article described the meaning, characteristics, application scenarios, basic operations, and the implementation process of C language for several types of linear lists such as sequential lists, singly linked lists, doubly linked lists, circular linked lists, and static linked lists. Through comparative analysis, these types of linear meters all have inherent characteristics, advantages and disadvantages, which determine their suitability for different application scenarios. At the same time, some linear meters also have comprehensive characteristics, making them applicable to more square scenes. The most representative characteristics of various linear tables are summarized as follows:
- Sequence table, efficient search operation
- Single linked list, efficient insert/delete operation
- Two-way linked list, two-way traversal, high traversal efficiency
- Circular linked list, starting from any node, you can traverse the entire linked list, with high traversal flexibility
- Static linked list, which combines the characteristics of sequence list and linked list, has efficient search operations, and can quickly add and delete element nodes
Below, we list the characteristics and applicable scenarios (reference) of several linear tables as a table for easy comparison. For a more detailed description, refer to the related article link at the end of this article.
2 Comparison of linear meter features
Storage address | storage | Storage density | Access structure | Space length | Find | Delete/insert | |
---|---|---|---|---|---|---|---|
Sequence table | continuous | Static | =1 | Sequential/random | Fixed length | O (1) | O (n) |
Single list | non-continuous | dynamic | <1 | order | Dynamic increase | O (n) | O (1) |
Doubly linked list | non-continuous | dynamic | <1 | order | Dynamic increase | O (n) | O (1) |
Circular linked list | non-continuous | dynamic | <1 | order | Dynamic increase | O (n) | O (1) |
Static linked list | non-continuous | Static | <1 | order | Fixed length | O (1) | O (1) |
3 Reference for application scenarios of linear table
Application scenario | Linear table selection |
---|---|
Fixed table length | Sequence table/static linked list |
Frequent search operations | Sequence table/static linked list |
Frequent insert/delete operations | Linked list |
Multiplex buffer queue | Circular linked list |
Two-way traversal | Doubly linked list |
Take into account the efficiency of search/insert/delete | Static linked list |
Joseph ring problem | Circular linked list |
LRU cache elimination algorithm | Circular linked list |
4 Article link
[1] Data structure review-linear table concept (the difference between sequential table and linked list)