BFS i.e. Breadth-First Search, is a vertex-based technique for finding the shortest path in the graph. It uses a Queue data structure that follows first in first out. DFS i.e. Depth First Search, is an edge-based technique. It uses the Stack data structure and performs two stages, first visited vertices are pushed into the stack, and second if there are no vertices then visited vertices are popped.

Posted September 12, 2022 by Rohith and Anusha ‐ 3 min read

quick-references blog bfs dfs differences

Subscribe For More Content