0Pricing
Competitive Programming Academy · Lesson

Connected Components & Flood Fill

Count islands and label regions.

What a Component Is

A connected component is a group of nodes you can all reach from one another. A graph can hold several separate groups. 🧩

Counting Components

To count components, run a traversal from every unvisited node. Each fresh start marks one whole new group.

All lessons in this course

  1. Adjacency Lists from Input
  2. BFS for Shortest Unweighted Paths
  3. DFS, Recursion & Iterative Stacks
  4. Connected Components & Flood Fill
← Back to Competitive Programming Academy