Topic 4 (Search) — pick a strategy
Both apps open in a new tab. Click any node to set the Goal, then use Next Step to play the algorithm one action at a time.
DFSStack
Depth-First Search Visualizer
Dives down one branch as far as it can before backtracking, driven by an explicit stack. Watch push, visit, pop and backtrack actions update the stack, traversal order and evaluation table.
Open the DFS visualizer →
BFSQueue
Breadth-First Search Visualizer
Explores the tree ring by ring from the Start node, driven by a queue (the frontier). Watch which nodes get enqueued, visited and closed — and when BFS finds the shortest path.
Open the BFS visualizer →
How to use them in class
- Predict first: with the tree visible, write down the order you expect the nodes to be visited — then step through and compare.
- Same tree, two strategies: run DFS and BFS on the identical Start/Goal and contrast the visited order and the fringe contents.
- Depth vs completeness: see why DFS can go off down a wrong branch forever, while BFS always finds a shallowest solution.