当前位置:网站首页>Advantages, disadvantages and summary of sequence list and linked list
Advantages, disadvantages and summary of sequence list and linked list
2022-07-24 03:07:00 【Demon--hx】
Catalog
The advantages of a sequence table :
The disadvantages of the sequence table :
Advantages of headless one-way acyclic linked list :
Disadvantages of headless one-way acyclic linked list :
Take the lead in two-way circular linked list :
Take the lead in the disadvantages of two-way circular linked list :
There are mainly two basic storage structures in computers for storing linear tables : Sequential and chain storage structures
One 、 The order sheet
The advantages of a sequence table :
1、 The essence of a sequential table is an array , Physical space is continuous .
2、 Subscript random access .
3、 The efficiency of tail insertion and deletion is high , No need to move data , The time complexity is O(1).
4、cpu High cache hit rate .
The disadvantages of the sequence table :
1、 When there is not enough space, the capacity needs to be expanded , Capacity expansion has certain performance consumption , Generally, it is capacity expansion 2 times , But there is also a certain waste of space
2、 It is inefficient to insert and delete in the head or in the middle , You need to move the data , The time complexity is 0(n).
Two 、 Linked list
Linked lists have many structures , In practice, the most commonly used are headless one-way acyclic list and leading two-way acyclic list .
Advantages of headless one-way acyclic linked list :
1、 You can apply for and release space as needed , Don't worry about insufficient space .
2、 The insertion and deletion efficiency of the head and the middle position is high , No need to move data .
Disadvantages of headless one-way acyclic linked list :
1、 Random access is not supported , Finding elements is inefficient .
2、 Insert and delete the middle or tail position of the linked list , You need to traverse nodes , The time complexity is 0(n).
Take the lead in two-way circular linked list :
1、 You can apply for and release space as needed , Don't worry about insufficient space .
2、 The time complexity of inserting and deleting anywhere is 0(1).
Take the lead in the disadvantages of two-way circular linked list :
1、 Subscript random access is not supported .
summary :
1、 The essence of linked list is designed for the shortcomings of sequential list , Therefore, you can choose different storage structures in different situations
2、 If the main operation of a linear table is to find , Rarely do insert or delete operations , You can choose the sequence table as the storage structure .
3、 If the linear table needs to be inserted or deleted frequently , You can choose the linked list as the storage structure .
4、 Headless one-way acyclic linked lists are generally not used alone to store data , In fact, it is more as a substructure of other data structures , For example, hash bucket 、 The adjacency matrix of a graph .
5、 The leading two-way circular linked list is generally used to store data separately , It is also a commonly used linked list data structure in practice .
边栏推荐
- Analyze the space practice field required by maker education activities
- Is the reverse repurchase of treasury bonds safe? How to open an account online?
- Example of producer consumer code implemented by the destructor framework without lock
- Why use the well architected framework?
- How to realize software function safety
- The function of SIP account - tell you what is SIP line
- JS small game running bear and cat source code
- Do the right thing, do it right
- ssm的求职招聘系统兼职应聘求职
- JVM initial
猜你喜欢

openEuler 资源利用率提升之道 01:概论

Attack and defense world web practice area (view_source, get_post, robots)

Honey, we are homeless now

攻防世界WEB练习区(webshell、command_execution、simple_js)

Recommendation system topic | recommendation system architecture and single domain cross domain recall model

String.split() the most detailed source code interpretation and precautions

SSM family financial management personal financial management system accounting system

FTP服務與配置

TCP connection principle

The function of SIP account - tell you what is SIP line
随机推荐
SSM's technical forum includes front and back offices
O3DE 的Lumberyard 游戏引擎
uva1445
322. Change
Basic knowledge of trigger (Part 2)
c语言小练习
Attack and defense world web practice area (webshell, command_execution, simple_js)
How to realize software function safety
summernote富文本编辑器
Do the right thing, do it right
String.split() the most detailed source code interpretation and precautions
Babylon.js cool canvas background animation JS special effects
(六)装饰器扩展之[email protected]使用原理
OSPF comprehensive experimental configuration
攻防世界WEB練習區(view_source、get_post、robots)
MariaDB related instructions
Summernote rich text editor
MySQL sub database and sub table and its smooth expansion scheme
198. House raiding
To forge ahead on a new journey, the city chain science and technology carnival was grandly held in Xiamen