Overview - Number of Islands BFS and DFS
What is it?
Number of Islands is a problem where you count how many separate groups of connected 'land' cells exist in a grid. Each cell can be water or land, and connected land cells form an island. We use BFS (Breadth-First Search) or DFS (Depth-First Search) to explore and mark these islands. This helps us find how many islands are in the grid.
Why it matters
Without this method, it would be hard to find connected groups in grids, which is important in maps, games, and image processing. It helps computers understand shapes and clusters in data. Without it, many applications like flood fill, network grouping, or pathfinding would be inefficient or impossible.
Where it fits
You should know basic arrays and grids before this. After this, you can learn graph traversal algorithms, connected components, and more complex grid problems like shortest path or maze solving.
