Knowledge about trees, binary trees, and forests

One, the related concepts of the tree

1. Definition of tree

Insert picture description here

Insert picture description here

2. Basic terminology of tree

Insert picture description here
Insert picture description here

3. Three representation methods of the tree

(1) Parental representation

Insert picture description here

(2) Child linked list notation

Insert picture description here
You can sacrifice space to allow each node to record the location of its parents at the same time.
Insert picture description here

(3) Child brother notation

Insert picture description here
Insert picture description here

4. Tree traversal

Insert picture description here

5. The traversal of the forest

Insert picture description here
Insert picture description here

Insert picture description here

Second, the related concepts of the binary tree

1. Binary tree definition

Insert picture description here
Insert picture description here

2. Full binary tree

Insert picture description here

3. Complete binary tree

Insert picture description here

Insert picture description here

4. Two storage methods of binary tree

Insert picture description hereInsert picture description here
Insert picture description here

5. The nature of the binary tree

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

6. Traverse the binary tree

Insert picture description here

Insert picture description here
Example:
Insert picture description here
Insert picture description here
Determine the binary tree based on the binary tree sequence.
Insert picture description here

7. Conversion of forest to binary tree

Insert picture description here

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_46027243/article/details/113833981