Consider the following graph given below.
Which of the following is not correct breadth first traversal?
(A) HGDCFAEB
(B) HGFCDEAB
(C) HGCFDAEB
(D) HGCFDEBA
Answer: (D)
Explanation: Breadth first search traversal uses Queue data structure which works as first in first out order. BFT prnts node level by level, so HGCFDEBA is not valid becasue parent D should print child A before anyone prints node B.
So, option (D) is not correct.
Quiz of this Question
Share your thoughts in the comments
Please Login to comment...