Programming and Data Structures TREES (Set-1) 1. Consider The Following Tree
Programming and Data Structures TREES (Set-1) 1. Consider The Following Tree
TREES (Set-1)
If the post-order traversal gives ab-cd*+ then the label of the nodes 1, 2, 3,….. will be:
(a) +, -, *, a, b, c, d (b) a, -, b, +, c, *, d
(c) a, b, c, d, -, *, + (d) -, a, b, +, *, c, d
If this tree is used for sorting, then a new number 8 should be placed as:
3. A binary tree in which every non-leaf node has non-empty left and right subtrees is called a
strictly binary tree. Such a tree with 10 leaves.
(a) cannot have more than 19 nodes (b) has exactly 19 nodes
(c) has exactly 17 nodes (d) cannot have more than 17 nodes
1
4.The depth of a complete binary tree with ‘n’ nodes is (log is to the base 2):
6.Which of the following traversal techniques lists the nodes of a binary search tree in ascending
order?
(a) 12 (b) 13
(c) 5 (d) 15
(a) 12 (b) 13
(c) 14 (d) 15
(a) ab + cd - * (b) ab cd + - *
(c) ab + cd * - (d) ab + - cd *
10.A binary tree has n leaf nodes. the no. of nodes of degree 2 in this tree is:
2
11.The no. of binary trees with 3 nodes which when traversed by post-order gives the sequence
A, B, C is:
(a) 3 (b) 9
(c) 7 (d) 5
12.A 3-ary tree is a tree in which every internal node has exactly 3 children. The no. of leaf
nodes in such a tree with 6 internal nodes will be:
(a) 10 (b) 23
(c) 17 (d) 13
14.The height of a binary tree is the maximum number of edges of any root to leaf path. The
maximum number of nodes in a binary tree of height n is:
(a) d e b f g c a (b) e d b g f c a
(c) e d b f g c a (d) d e f g b c a
16.The binary search tree contains the values—1, 2, 3, 4, 5, 6, 7 and 8. The tree is traversed in
preorder and the values are printed out. Which of the following sequences is a valid output?
(a) 5 3 1 2 4 7 8 6 (b) 5 3 1 2 6 4 8 7
(c) 5 3 2 4 1 6 7 8 (d) 5 3 1 2 4 7 6 8