Q. How do you find the height of a binary tree?
-
A.
Count the number of nodes
-
B.
Count the number of edges
-
C.
Use level order traversal
-
D.
Use in-order traversal
Solution
The height of a binary tree is defined as the number of edges on the longest path from the root to a leaf node.
Correct Answer:
B
— Count the number of edges
Learn More →
Q. What is the primary data structure used to implement a queue for level order traversal?
-
A.
Stack
-
B.
Array
-
C.
Linked List
-
D.
Queue
Solution
A queue is the primary data structure used to implement level order traversal of a binary tree.
Correct Answer:
D
— Queue
Learn More →
Q. Which traversal method visits the root node last?
-
A.
In-order
-
B.
Pre-order
-
C.
Post-order
-
D.
Level-order
Solution
Post-order traversal visits the root node last, after visiting both left and right subtrees.
Correct Answer:
C
— Post-order
Learn More →
Showing 1 to 3 of 3 (1 Pages)