【Note】Chain storage structure

Designing different node structures can form different chain storage structures. Commonly used ones include: binary linked list , three-pronged linked list , and clue linked list (use empty link fields to store clues pointing to the predecessor or successor).

Binary linked list storage VS general binary tree

Binary linked list VS binary tree

Knowledge points:

  • A binary linked list is uniquely determined by the root pointer root. If the binary tree is empty, then root=NULL; if a child of the node does not exist, the corresponding pointer is NULL.
  • In a binary linked list with n nodes, there are a total of 2n pointer fields. Only n-1 of them are used as the left and right children of the node, and the remaining n+1 pointer fields are empty. 

Three-pronged linked list

In order to facilitate finding the parents of a node, a pointer field pointing to the parent node can be added to the node structure. At this time, the binary linked list becomes a trifurcated linked list.

Guess you like

Origin blog.csdn.net/2301_78131481/article/details/134036634