Consider the following graph:
Among the following sequences:
Which are the depth-first traversals of the above graph?
Answer will be (D)
DFS goes upto how much depth possible and then backtrack and go to the next link.
Here only 'abfehg' not possible because e and h consecutively is not possible by any backtracking of DFS traversal
@srestha mam, using stack i am getting only 4th one as valid depth first traversal. Because, an elemant is first popped out and then its adjacent elements are pushed onto stack. Can you please show using stack how 1 and 3 are also possible?
@srestha mam, here i have attached scanned image pdf