Which of the following traversal in a binary tree is similar to depth first traversal?

Which of the following traversal in a binary tree is similar to depth first traversal?
A. level order
B. post order
C. pre order
D. in order
 
Answer: C
Explanation: In DFS we keep on exploring as far as possible along each branch before backtracking. It terminates when all nodes are visited. So it is similar to pre order traversal in binary tree.
 

Tìm kiếm

Back
Top