WORLD 6

GRAPHS

Grids, dependencies and travel times: search outward, put steps in order, find the fastest route.

STAGE 0 Graphs tutorial

0:00 / 0:00

The move

Explore outward from a start. Breadth-first search uses a queue and ripples out ring by ring (fewest steps); depth-first search dives deep with a stack or recursion. Mark every node you visit so you never loop.

Spot it
The problem says connected, neighbours, islands, network, path, prerequisites or fewest steps. A grid is a graph too.
Cost
Each node and edge is handled once: O(V + E) time and O(V) space for the visited set.

15 STAGES Graphs problems

☆☆☆☆☆ Clear 5 to finish this world.