Q. If a binary tree has n nodes, what is the maximum number of leaf nodes it can have?
-
A.
n
-
B.
n/2
-
C.
n/3
-
D.
n/2 + 1
Solution
In a binary tree, the maximum number of leaf nodes can be n, which occurs in a degenerate tree.
Correct Answer:
A
— n
Learn More →
Q. In a binary tree, if the in-order and post-order traversals are given, how can you reconstruct the tree?
-
A.
Using only in-order
-
B.
Using only post-order
-
C.
Using both in-order and post-order
-
D.
Using pre-order and in-order
Solution
To reconstruct a binary tree, both in-order and post-order traversals are needed.
Correct Answer:
C
— Using both in-order and post-order
Learn More →
Q. In a binary tree, if the in-order traversal yields the sequence [D, B, E, A, F, C], what is the pre-order traversal?
-
A.
[A, B, D, E, C, F]
-
B.
[A, B, E, D, C, F]
-
C.
[A, C, B, D, E, F]
-
D.
[A, B, D, C, E, F]
Solution
The pre-order traversal can be derived from the in-order traversal and the structure of the tree, yielding [A, B, D, E, C, F].
Correct Answer:
A
— [A, B, D, E, C, F]
Learn More →
Showing 1 to 3 of 3 (1 Pages)