Sequence list related blogs
Sequence table of linear table
Linked List Related Blogs
Singly linked list of linear list
Bidirectional headed circular linked list of linear lists
Classic example: singly linked list example
Difference Between Sequential List and Linked List
The best structure in the linked list is: doubly headed circular linked list
sequence table | linked list | |
advantage | 1. The physical space is continuous, which is convenient for random access with subscripts. |
1. High efficiency for insertion and deletion at any position. |
2. The CPU cache hit rate is high. |
2. Apply for and release space as needed. |
|
shortcoming | 1. Since the physical space needs to be continuous, the space needs to be expanded, and the expansion itself has a certain consumption. There is also a corresponding waste of space in the expansion mechanism. |
Subscripted random access is not supported. Some algorithms do not support working on it. Such as: binary search, sorting, etc. |
2. Inserting and deleting data at the head or in the middle, moving data, is inefficient. O(N) |
Explaining the high CPU cache hit rate
Hit rate: The CPU will not directly access the memory, because it dislikes the memory speed is too slow, and will load the data into the third-level cache or register.
4 or 8 bytes of small data are placed in the register, and large data is placed in the cache.
The CPU will see whether the data is cached, and it will be called a hit, and it will be accessed directly.
If it is not, it is a miss, first load the data from memory into the cache and then access it.