CS 411 Fall 2025  >  Outline & Supplemental Notes for September 15, 2025


CS 411 Fall 2025
Outline & Supplemental Notes
for September 15, 2025

Outline

Exhaustive Search [L 3.4]

Depth-First Search & Breadth-First Search [L 3.5]

Supplemental Notes

The text describes DFS as a recursive algorithm. As with all recursive algorithms, we can reformulate it in a non-recursive form by using our own stack. With DFS this is both easy and instructive.

A non-recursive DFS is essentially as follows.

Notes

The above algorithm can be turned into a BFS simply by changing the stack to a queue. When we do this, we generally want to push (enqueue) the unvisited neighbors in forward order.