Summary of some basic concepts of linked lists (unfinished)

definition

The chain storage structure of a linear table is called a linked list: n nodes are discretely distributed and connected to each other by pointers. Each node has only one successor node and predecessor node, the first node has no predecessor node, and the tail node has no successor node.
The advantages of the list: the list does not need to know in advance the size of stored data, can take full advantage of computer memory, dynamic memory allocation management;
disadvantages list: the list of the advantages of an array of random access lost, while the addition of the target domain, by Large memory footprint; unable to obtain the length efficiently, and unable to quickly access the element based on the offset.

classification

Method one: single-linked list, double-linked list
Method two: circular linked list, non-circular linked list

analysis

Singly linked list: insert, time complexity is O(1), do not need to move all subsequent elements like an array; delete, time complexity is O(n), because the storage location of the previous element of the deleted element is not known.
Double-linked list: insert, the time complexity is O(1); delete, the time complexity is O(1), because the previous element can be accessed through a pointer to the previous element, which is different from a singly linked list.

The similarities and differences between single-linked lists and double-linked lists

Guess you like

Origin blog.csdn.net/AWhiteDongDong/article/details/111146211