Week 4 · Day 25 of 42

Graph: BFS and DFS

BFS explores nodes level by level — first time you reach a node is the shortest path. DFS explores as deep as possible before backtracking.

Checking access

Spotted a mistake on this page?

Wrong formula, broken animation or confusing wording. Tell us and we will fix it.