Data Structure Test Set 8
Q36➡ | We are given a set of n distinct elements and an unlabeled binary tree with n nodes. In how many ways can we populate the tree with the given set so that it becomes a binary search tree? |
i ➥ 0 |
ii ➥ 1 |
iii ➥ n! |
iv ➥ (1/(n+1)). 2nCn |
Q37➡ | The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42. Which one of the following is the postorder traversal sequence of the same tree? |
i ➥ 10, 20, 15, 23, 25, 35, 42, 39, 30 |
ii ➥ 15, 10, 25, 23, 20, 42, 35, 39, 30 |
iii ➥ 15, 20, 10, 23, 25, 42, 35, 39, 30 |
iv ➥ 15, 10, 23, 25, 20, 35, 42, 39, 30 |
Q38➡ | A priority queue is implemented as a Max-Heap. Initially, it has 5 elements. The level-order traversal of the heap is: 10, 8, 5, 3, 2. Two new elements 1 and 7 are inserted into the heap in that order. The level-order traversal of the heap after the insertion of the elements is: |
i ➥ 10, 8, 7, 3, 2, 1, 5 |
ii ➥ 10, 8, 7, 2, 3, 1, 5 |
iii ➥ 10, 8, 7, 1, 2, 3, 5 |
iv ➥ 10, 8, 7, 5, 3, 2, 1 |
Q39➡ | Which of the following is/are correct inorder traversal sequence(s) of binary search tree(s)? 3, 5, 7, 8, 15, 19, 25 5, 8, 9, 12, 10, 15, 25 2, 7, 10, 8, 14, 16, 20 4, 6, 7, 9, 18, 20, 25 |
i ➥ 1 and 4 only |
ii ➥ 2 and 3 only |
iii ➥ 2 and 4 only |
iv ➥ 2 only |
Q40➡ | The height of a tree is the length of the longest root-to-leaf path in it. The maximum and minimum number of nodes in a binary tree of height 5 are |
i ➥ 63 and 6, respectively |
ii ➥ 64 and 5, respectively |
iii ➥ 32 and 6, respectively |
iv ➥ 31 and 5, respectively |
Weekly Test GATE/NTA NET CSA
36, i
37, ii
38, ii
39, iv
40, iv
36:iii
37:iv
38:i
39:i
40:i