Data structure review-comparison and summary of several types of linear tables


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)

[2] Data structure review-detailed explanation of sequence table operations and C language implementation

[3] Data structure review-detailed explanation of singly linked list operations and C language implementation

[4] Data structure review-detailed explanation of doubly linked list operation and C language implementation

[5] Data structure review-detailed explanation of circular linked list operations and C language implementation

[6] Data structure review-detailed explanation of static linked list operation and C language implementation

Guess you like

Origin blog.csdn.net/qq_20553613/article/details/108267875