What will be the result of depth first traversal in the following tree?

Kim Trang

New member
What will be the result of depth first traversal in the following tree?
A. 4 2 5 1 3
B. 1 2 4 5 3
C. 4 5 2 3 1
D. 1 2 3 4 5
 
Answer: B
Explanation: Depth first search is similar to pre order traversal in a tree. So here we will get the same result as for the pre order traversal (root,left right).
 

Tìm kiếm

Back
Top