Blog

Your dream job? Lets Git IT.
Interactive technical interview preparation platform designed for modern developers.

XGitHub

Platform

  • Categories

Resources

  • Blog
  • About the app
  • FAQ
  • Feedback

Legal

  • Privacy Policy
  • Terms of Service

© 2025 LetsGit.IT. All rights reserved.

LetsGit.IT/Categories/Algorithms
Algorithmsmedium

BFS vs DFS?

Tags
#graph#bfs#dfs#search#traversal
Back to categoryPractice quiz

Answer

BFS explores a graph level by level using a queue and finds the shortest path in unweighted graphs. DFS explores as deep as possible using recursion/stack; it’s useful for topological sort, cycle detection and often uses less memory on wide graphs.

Related questions

Algorithms
Backtracking: what is it and when do you use it?
#backtracking#search#pruning
Algorithms
What is a topological sort and when is it possible?
#topological-sort#dag#graph
Algorithms
When can BFS replace Dijkstra’s algorithm?
#shortest-path#bfs#dijkstra
Algorithms
BFS vs DFS — what’s the difference and when to use which?
#bfs#dfs#graph
Algorithms
What is Dijkstra's Algorithm?
#graph#shortest-path#dijkstra
Algorithms
Explain Binary Search.
#search#binary-search#algorithm