Linked list structure and operation

What is a linked list structure:

  The linked list structure is composed of many nodes, each of which contains two parts:

  Data part: save the actual data of the node.

  Address part: The address of the next node is saved.

Features of linked lists:

The location of the node in the memory is arbitrary, that is, logically adjacent data elements are not necessarily physically adjacent

When accessing, you can only enter the linked list through the head pointer, and scan the remaining nodes backward through the pointer field of each node, so the time it takes to find the first node and the last node varies.

The advantages of linked lists:

The number of data elements can be freely expanded, inserted, deleted and other operations without moving the data, only need to modify the link pointer, the modification efficiency is more

 

Disadvantages of linked lists:

The storage density is small and the access efficiency is not high. You must use sequential access, that is, when accessing data elements, you can only access them in the order of the linked list.

Guess you like

Origin www.cnblogs.com/zhuyeshen/p/12724068.html
Recommended