Question 1 For a binary search tree, the key value at the root is Question 1 opt
ID: 666336 • Letter: Q
Question
Question 1
For a binary search tree, the key value at the root is
Question 1 options:
a) the smallest key
b) the largest key
c) larger than all keys in the left subtree of root
d) smaller than all keys in the left subtree of root
Question 2
If the root node of a binary search tree has a null left link, its key is the smallest key in the tree.
Question 2 options:
Question 3
If a binary search tree contains 12 keys and there are 5 keys in the left subtree, how many keys are in the right subtree?
Question 3 options:
a) 4
b) 5
c) 6
d) 7
Question 4
Integer keys 40, 10, 30, 50, and 20 are inserted (with method put) into an initially empty binary search tree. What key is the parent of 30?
Question 4 options:
a) 10
b) 20
c) 40
d) 50
Question 5
Integer keys 30, 60 10, 20, 70, 40, 50 are inserted in that order (with method put) into an initially empty binary search tree. What key(s) are the children of 60?
Question 5 options:
a) 60 has no children
b) 20 and 70
c) 40 and 70
d) 50 and 70
e) 70 only
Question 6
In a binary search tree, if any node has no left child, then its key must be the minimum key in the tree.
Question 6 options:
a) the smallest key
b) the largest key
c) larger than all keys in the left subtree of root
d) smaller than all keys in the left subtree of root
Explanation / Answer
1) c //in binary tree root element is always larger than the left subtree elements and smaller than right subtree.
2) True //as root is larger than all its left subtree and smaller than right subtree,if left tree is null then root will be smallest.
3) c //6 will be and.because total(12)-(left subtree(5)+root(1))=right subtree(6);
4) a //if inserted in given order root of 30 will be 10
5) c //40 and 70 will be direct children of 60 if inserted in given order
6) false // 30 //in this tree 20 has no left child but it is not smallest,10 is smallest.
/
10 50
20
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.