Worksheetsunit-4 test-2
Total questions: 20
Worksheet time: 57mins
Suppose a binary search tree with 1000 distinct elements is also a complete binary tree. The tree is stored using the array representation of binary heap trees. Assuming that the array indices start with 0, the 3rd largest element of the tree is stored at index ___________.
509
409
510
408
The preorder traversal of a binary search tree is 15, 10, 12, 11, 20, 18, 16, 19. Which one of the following is the postorder traversal of the tree?
20, 19, 18, 16, 15, 12, 11, 10
10, 11, 12, 15, 16, 18, 19, 20
11, 12, 10, 16, 19, 18, 20, 15
19, 16, 18, 20, 11, 12, 10, 15
The postorder traversal of a binary tree is 8,9,6,7,4,5,2,3,1. The inorder traversal of the same tree is 8,6,9,4,7,2,5,1,3. The height of a tree is the length of the longest path from the root to any leaf. The height of the binary tree above is ______.
3
4
5
2
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
63,6
64,5
32,6
31,5
Which of the following is/are correct inorder traversal sequence(s) of binary search tree(s)?
I. 3, 5, 7, 8, 15, 19, 25
II. 5, 8, 9, 12, 10, 15, 25
III. 2, 7, 10, 8, 14, 16, 20
IV. 4, 6, 7, 9 18, 20, 25
I. IV.
II. III.
II. IV.
II.
What are the worst-case complexities of insertion and deletion of a key in a binary search tree?
log(n), log(n)
n,n
n, log(n)
log(n),n
A binary tree T has 20 leaves. The number of nodes in T having two children is _______________.
20
19
18
22
Consider a binary tree T that has 200 leaf nodes. Then, the number of nodes in T that have exactly two children are ________.
200
202
199
201
While inserting the elements 71,65,84,69,67,83 in an empty binary search tree in the sequence shown, the element in the lowest level is
65
67
83
69
Consider a rooted n node binary tree represented using pointers. The best upper bound on the time required to determine the number of subtrees having exactly 4 nodes O(na Logbn ).
Then the value of a + 10b is _________
4
3
2
1
The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number of nodes in a binary tree of height h is:
2h-1
2h-2
2h+1-1
2h+1
The maximum number of binary trees that can be formed with three unlabeled nodes is:
3
1
5
4
A scheme for storing binary trees in an array X is as follows. Indexing of X starts at 1 instead of 0. the root is stored at X[1]. For a node stored at X[i], the left child, if any, is stored in X[2i] and the right child, if any, in X[2i+1]. To be able to store any binary tree on n vertices the minimum size of X should be
log2 n
n
2n+1
2n-1
In a binary tree, the number of internal nodes of degree 1 is 5, and the number of internal nodes of degree 2 is 10. The number of leaf nodes in the binary tree is
10
12
15
11
The numbers 1, 2, ........, n are inserted in a binary search tree in some order. In the resulting tree, the right subtree of the root contains p nodes. The first number to be inserted in the tree must be
p
p+1
n-p
n-p+1
Consider the following nested representation of binary trees: (X Y Z) indicates Y and Z are the left and right sub stress, respectively, of node X. Note that Y and Z may be NULL, or further nested. Which of the following represents a valid binary tree?
(1 2 (4 5 6 7))
(1 (2 3 4) 5 6 7)
(1 (2 3 4) (5 6 7))
(1 (2 3 null) (4 5 ))
Which of the following statements is false?
tree with n nodes has n-1 edges
we can construct a labelled binary tree using postorder and inorder results
a complete binary tree with n internal nodes has n+1 leaves
the max number of nodes of a binary tree of height h is
2h+1-1
In the balanced binary tree in Fig. given below, how many nodes will become unbalanced when a node is inserted as a child of the node “g”?
1
7
8
3
A binary tree T has n leaf nodes. The number of nodes of degree 2 in T is:
log2n
n-1
n
2n
If the no of leaves in a tree is not a power of 2,then the tree is not a binary tree.
true
false
