Number of Islands BFS and DFS
📖 Scenario: Imagine you have a map represented as a grid of water and land cells. You want to find out how many separate islands are on the map. An island is a group of connected land cells (horizontally or vertically). This is useful in real-world situations like counting forest patches or lakes on a satellite image.
🎯 Goal: Build a program in C that counts the number of islands in a given 2D grid using both Breadth-First Search (BFS) and Depth-First Search (DFS) methods.
📋 What You'll Learn
Create a 2D array representing the map with exact values
Create variables for grid dimensions
Implement BFS and DFS functions to explore islands
Count and print the number of islands found by BFS and DFS
💡 Why This Matters
🌍 Real World
Counting islands or connected regions is useful in geography, image processing, and network analysis.
💼 Career
Understanding graph traversal algorithms like BFS and DFS is essential for software engineering, data science, and technical interviews.
Progress0 / 4 steps