The list?

1. What is the list?
List storage unit is physically non-continuous, non-sequential storage structure, different from the stacks and queues. List consists of a series of nodes, each node comprising two parts: a data field storing data elements, and the other is stored under a node address pointer field.

Since the order is not necessarily stored in a linked list insertion can be achieved when O (1) complexity, than another linear sequence table faster table, but to find a node or access node identification number is required O (n) time, while the corresponding linear time complexity sequence table and the table are O (logn) and O (1).
*** mark ---- >>> []
[using a linked list structure can overcome the disadvantage of an array of linked lists need to know in advance the size of the data, the list structure can take full advantage of computer memory space, flexible dynamic memory management. But we lost the advantage of an array of linked lists random read, while the list due to the increase in the target domain settled point, the space overhead is relatively large. ]

Tulio

2. The list of structure

2.1, node
node contains two parts, the element area for storing data, pointing to the next node is part of the pointer region, the green part of the above figure represent data area pointer indicating the blue part of the region, which together constitute a node.
2.2, and last node
of a node is the first node in the list, the last node is tail node.

2.3, has a head and a headless list list
*** mark ---- >>> []
[headless list refers to the first node has both [data] field, another pointer field, the first node is both a first node is the first node. ]

[List has a head only refers to the first node pointer field [], but no data field. ] Usually linked list header data field may store some information about the current list.

end.

Guess you like

Origin www.cnblogs.com/wn798/p/12066423.html