Algorithms | Graph Traversals | Question 2
Traversal of a graph is different from tree because
(A) There can be a loop in graph so we must maintain a visited flag for every vertex
(B) DFS of a graph uses stack, but inorrder traversal of a tree is recursive
(C) BFS of a graph uses queue, but a time efficient BFS of a tree is recursive.
(D) All of the above
Answer: (A)
Explanation: See https://www.geeksforgeeks.org/depth-first-traversal-for-a-graph/
Quiz of this Question