27. The common use of binary trees and Detailed optimization - [STL template]

27. The common use of binary trees and Detailed optimization - [STL template]


My Blog [my blog]: New blog Zero cloud - Yun Yi campus plan

You can learn Oh! ! !


1. Definitions and properties of the tree (remember)

Graphical tree

More practical concept and properties, which properties are often used to ①⑤ boundary data

① trees can no node called the empty tree

② since the beginning of the tree from the root node, the root node of the first layer, the sub-tree root node as the second layer, and so on

③ subtree root number called, degree of three trees were 9-1 in FIG. 3, 5

④ acyclic tree, the tree has n nodes, the number of edges n-1 == must be satisfied and the number of edges is equal to the number of vertices minus one must be a tree. (Necessary and Sufficient Condition)

⑤ leaf node is 0 degrees (bottom), so that there is only one tree node (i.e., only the root node), the root node to be regarded as a leaf node.

⑥ junction depth == height (with the longest number of nodes)

⑦ combination of a number of trees, called forest

Remember the line, the binary tree is the focus of the following


2. binary tree recursive definition

1. No binary tree root node, the tree is empty
2. The root node of a binary tree configuration, the left subtree, right subtree

Do not

Guess you like

Origin blog.csdn.net/xg987599519/article/details/104219383