
Graph Traversal: BFS vs DFS Step by Step
Step through BFS and DFS on graphs visually. Compare queue vs stack, see the visited set in action, with interactive simulator and Python code.
Loading...
Crack the code, ace the interview
28 posts
Showing 1-12 of 28 posts

Step through BFS and DFS on graphs visually. Compare queue vs stack, see the visited set in action, with interactive simulator and Python code.

Master topological sort with Kahn's algorithm and DFS. Interactive simulator lets you build DAGs and watch in-degrees drop to zero step by step.

Step through Dijkstra's algorithm visually. See how a min-heap and edge relaxation find shortest paths, with interactive simulator and Python code.

Master Interval Dynamic Programming. Build dp[i][j] intuition, see why greedy fails, and derive Burst Balloons and Palindrome Subseq like a candidate.

Master the String DP pattern by deriving Longest Common Subsequence and Edit Distance from first principles. Two LeetCode classics, one template.

Master Unbounded Knapsack DP by deriving Coin Change and Coin Change II from first principles. Two LeetCode classics, one forward-loop template.

Master the 0/1 Knapsack DP pattern by deriving Partition Equal Subset Sum and Target Sum from first principles. Two LeetCode classics, one template.

Master Union-Find with path compression and union by rank. Interactive playground lets you merge sets and watch trees flatten in real time.

Master Bitmask Dynamic Programming. Build dp[mask] intuition, see why backtracking explodes, and derive K Equal Subsets and Work Sessions like a candidate

Master the Grid DP pattern by deriving Unique Paths and Minimum Path Sum from first principles. One cell-by-cell template, two LeetCode classics.

Master Decision Dynamic Programming. Build dp[i] intuition, see why greedy fails, and derive Job Scheduling and Min Cost Tickets like a candidate.

Master state machine DP with stocks. Build the holding-vs-cash mental model and crack Best Time to Buy and Sell Stock I and with Cooldown.