-
It is strongly recommended that the landlord make the topic clear, including how to input and what the output format is.
-
The node sequences traversed by the pre-order are: befcgdh; The node sequences traversed by the middle order are: febgchd; The sequence of nodes traversed in the post-order is: feghdcb.
The pre-order traversal first visits the root node, then traverses the left subtree, and finally traverses the right subtree; The order traversal first traverses the left subtree, then visits the root node, and finally traverses the right subtree; The sequential traversal is first left, then right, and then root, i.e., the left subtree is traversed first, then the right subtree, and finally the root node is visited.
-
Pre-order traversal of fdbacegihj
The middle order traverses abcdefhijg
Subsequent traversal of Acbedhjigf
-
<> the first number as the root node, divide the next number into those larger than 30 and smaller than 30, the small number is placed on the left, the large number is placed on the right, and then in the order in which the numbers appear, one by one, the larger than the root node is placed on the right, and the small one is placed on the left.
-
30 below left, 15 right, 43
15 below left, 8 right, 25
43 below right 49
8 below right 13
25 below left, 20 right, 28
49 below left, 46 right, 55
13 below the left 10
-
First of all, understand the general idea:
Pre-order traversal: The operation to access the root node occurs before traversing its left and right subtrees.
Middle-order traversal: The operation of accessing the root node occurs in the traversal of its left and right subtrees.
Post-order traversal: The operation of accessing the root node occurs after traversing its left and right subtrees.
eg: The post-order traversal is dbcefgha, the middle-order traversal is edcbahfg, and the pre-order traversal is found (online example).
Solution: First, look at the post-order traversal dbcefgha, a is the total root node, and then find the middle order traversal the position of a in edcbahfg, then edcb is on the left branch of a, and hfg is on the right branch of a;
Repeat the first two steps, traversing the last digit from the back order to find the corresponding point, and traversing the middle order to find the corresponding point, and get the left and right branches.
Finally, get aecdbhgf, and then verify it yourself.
-
The last letter of the subsequent iteration is bifurcation bai
tree "roots"; du
The first of the pre-order traversal.
The letter zhi is the binary forked dao tree "root"; e/
d b\c/a
-
The sequence is traversed according to the number of layers, first at the top layer, then at the second layer, then at the third layer...
-
Answer]: b Binary sorting tree, also known as binary search staring tree, it is either an empty tree, or it is called a binary tree with the following Kai cherry properties: if its left subtree is not empty, the value of all nodes on the left subtree is less than the value of the root node; If its right subtree is not empty, the value of all nodes on the right subtree is greater than the value of the root node.
Based on these two properties of a binary sort tree, if the sequence obtained by traversing it in order is an ordered sequence, option b is correct.
First of all, it is necessary to understand what a binary tree is (and I guess the subject also understands). >>>More