Skip to main content

Depth-First Search

This video presents the same text shown beside it, spoken and on screen. It adds nothing the text does not say.

State

Depth-first search traverses a graph by recursively exploring each neighbor as far as each path allows, an explored set preventing revisits — cost in O(V plus E).

Show

A maze walked by always pushing forward and backtracking at dead ends is depth-first embodied.

Watch for

The explored set is what stops the wandering forever.

Builds on

Unlocks

  • Nothing yet depends on this.