Comparisons, step by step.

Each page compares two algorithms or data structures that are easy to confuse. It answers what differs and when to use which, then runs both step by step on the same input, with a table of differences and interview questions.

  • BFS vs DFS — A queue against a stack: both searches step by step on one tree, and when to use each.
  • Merge Sort vs Quick Sort — Split by position or by value: both sorts step by step on one array, and when to use each.
  • Dijkstra vs Bellman-Ford — Closest first against every edge: both on one graph with a negative edge, and when to use each.
  • Prim vs Kruskal — One tree against a forest: both build the same minimum spanning tree on one graph, and when to use each.
  • Stack vs Queue — Newest out against oldest out: the same six operations on both, and when to use each.

Each algorithm and data structure also has a page of its own: all topics.

All 30+ topics
in the app.

Download VisiGrab and step through every topic yourself, at your own pace.