Q. How many nodes are there in a full binary tree of height h?
-
A.
h
-
B.
2^h
-
C.
2^(h+1) - 1
-
D.
2^h - 1
Solution
A full binary tree of height h has 2^(h+1) - 1 nodes.
Correct Answer:
C
— 2^(h+1) - 1
Learn More →
Q. What is the time complexity of in-order traversal of a binary tree?
-
A.
O(n)
-
B.
O(log n)
-
C.
O(n log n)
-
D.
O(1)
Solution
The time complexity of in-order traversal of a binary tree is O(n), as it visits each node exactly once.
Correct Answer:
A
— O(n)
Learn More →
Q. Which of the following is true about a binary search tree?
-
A.
All nodes have at most two children.
-
B.
The left child is always greater than the parent.
-
C.
The right child is always less than the parent.
-
D.
The left child is always less than the parent.
Solution
In a binary search tree, the left child is always less than the parent, and the right child is always greater.
Correct Answer:
D
— The left child is always less than the parent.
Learn More →
Showing 1 to 3 of 3 (1 Pages)