Skip to content
Related Articles

Related Articles

Algorithms | Graph Traversals | Question 2

View Discussion
Improve Article
Save Article
Like Article
  • Difficulty Level : Easy
  • Last Updated : 28 Jun, 2021

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

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!