Data Structures and Algorithms -Chapter6- tree and binary - Exercises

Multiple Choice

1. For any binary tree T, if the number of nodes which the terminal is no, the number of nodes of degree 2 is n2, then ().
A. no = n2 + 1 B. n2 = n0 + 1 C. n0 = 2n2 + 1 D. n2 = 2n0 + 1

2. Let X be a tree, x 'is the corresponding binary X, the preorder traversal of X and X' of () traverse the same.
A. Preorder B. Inorder C. Subsequent D. uncertain

3. A depth of at most K binary tree () nodes.
A. 2k B. 2k -1 C. 2k- 1 D. 2k-1 -1

4. For the binary tree, it has up to the i-th layer () nodes.
A. 2i B. 2i -1 C. 2i- 1 D. 2i-1 -1

5. First junction sequence is different from the binary tree XYZ, it has () different forms.
A. 3 B. 4 C. 5 D. 6

6. A binary tree traversal preamble sequence IJKLMNO, sequence preorder JLKNMOI, the postorder traversal sequence ().
A. JLKMNOI B. LKNOMI C. LKJNOMI D. LNOMKJI

7. subsequent traversal of a binary tree sequence dabec, sequence preorder debac, the preamble sequence of traversal ().
A. ached B. decab C. deabc D. cedba

8. 35 complete binary tree having nodes depth ().
A. 5 B. 6 C. 7 D. 8

9. There will be a 100 node complete binary tree from top to bottom, left to right on the nodes are numbered, the root node number is 1, the number junction 49 of the left child number ().
A. 98 B. 99 C. 50 D. 48

10. Subsequent to the preamble and a sequence of the opposite binary tree, the binary tree must be () is a binary tree.
A. Empty or only a junction point B, the height of which is equal to the number of nodes
C. Either no left child node D. Either no right child node

11. Let X be a tree, x 'is the corresponding binary X, then X after the preorder and X' of () traverse the same.
A. Preorder B. Inorder C. Subsequent D. Layer order

12. Tree best suited to represent ().
A. B. ordered data elements out of order data elements
without contact between the data elements D. C. branched hierarchical relationship between elements

13. For a full binary tree, m a leaf, n-nodes, depth h, the ().
A. n = h + m B. h + m = 2n C. m = h-1 D. n = 2h-l

14. Analyzing clues binary tree has a left child node p is the condition ().
A. p! = Null B. p-> lchild! = null C. p-> ltag == 0 D. p-> ltag == 1

15. After some clues by binary sequence, a node has any point of its precursor and successor trail, this argument ().
A. True B. error

16. 5 binary tree of depth at most () nodes.
A.16 B. 32 C. 31 D. 10

17. In a non-empty sequence preorder traversal of the binary tree, the root node to the right ().
A. Only the right subtree of all nodes B. Only the right part of the sub-tree node
C. Only part of the left sub-tree node D. Only the left subtree of all nodes

18. Provided n, m is two nodes on a binary tree traversal sequence when, before the n-m is the condition ().
In B. A. n m rightward m n is the ancestor C. m n in the left D. m n is the offspring

Fill in the blank

1. For the binary tree, the at most (2i-1) th node on the i-th layer.

2. Binary tree of depth k at most (2K-1) th node.

3. The maximum level of the tree is called a node of the tree (depth).

4. Preamble sequence by a binary tree and (the sequence order) may be uniquely determined binary tree.

5. 5 is a complete binary tree of a height of at least (16) nodes.

6. After converted into a binary tree, a binary tree root without (right) subtree.

7. Containing a binary tree of n nodes, it is the height (floor (log2n) +1).

8. When a binary tree with n nodes is represented by a binary list, there are (n + 1) empty chain domain.

9. Huffman tree is weighted path length (minimum) binary tree.

10. A total of m Huffman tree having leaf nodes (2m-1) th node.

11. The eighth layer 8 nodes known complete binary tree, it leaves a number of nodes (68).

12. Seventh layer 10 has a complete binary tree leaf node is known, the entire binary tree is a maximum number of nodes (73).

Of i (i> = l) 13. Up to a binary tree layer (2i-1) th node; a full binary tree has n (n> 0) nodes total ((n + 1) / 2 ) two leaves and ((n-1) / 2) non-terminal nodes.

14. Results by conventional binary tree in preorder as ABC, asked if (5) different forms of the binary tree can be obtained through the results, which are binary ().

15. A data set {} 4,5,6,7,10,12,18 point node weights Huffman tree is constructed (), which is weighted path length ().

Short answer

1. Known weights: 4,2,5,7,5, draw the corresponding Huffman tree and calculating the weighted path length WPL.

2. If the binary tree and subsequent sequencing were: A, C, D, B, G, I, H, F, E. And A, B, C, D, E, F, G, H, I. Give the preamble binary tree.

3. How to achieve forest into a binary tree.

4. A first sequence of binary tree, and the subsequent sequence sequences are as follows, wherein a part is not given, the contents of the space is determined at the test and draw binary tree.
Preorder: _B F_ICEH inorder G: D_KFIA EJC_ after the sequence: K FBHJ GA

发布了391 篇原创文章 · 获赞 650 · 访问量 4万+

Guess you like

Origin blog.csdn.net/weixin_43896318/article/details/104092771