Skip to content

Commit 8ea814d

Browse files
committed
0200-number-of-islands.md Reworded.
1 parent a82f371 commit 8ea814d

2 files changed

Lines changed: 14 additions & 16 deletions

File tree

problems/0200-number-of-islands-2.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,16 @@ And this graph may have multiple **connected components** (islands):
4545

4646
Finding the number of islands is to find the number of `connected components`.
4747

48-
Each island can be expanded from a point that is land until it cannot be expanded any further, and the island is traversed.
49-
Therefore, the visited land needs to be marked as `visited` and does not need to be visited again next time.
48+
Walk from one node to the adjacent node until all nodes on the island are visited.
5049

5150
## Steps
52-
1. Find the first land point.
53-
1. Find all the adjacent land points of it.
54-
* There are two major ways to explore a `connected components` (island): **Breadth-First Search** and **Depth-First Search**.
55-
* For **Depth-First Search**, there are two ways to make it: `Recursive` and `Iterative`. So I will provide 3 solutions in total.
56-
* Mark each found land point as `V` which represents `visited`.
57-
1. After all lands on an island have been visited, look for the next non-visited land point.
58-
1. Repeat the above steps until all the land points have been `visited`.
51+
1. Find the first land.
52+
1. Find all the adjacent lands of it.
53+
* There are two major ways to explore a `connected components` (island): **Breadth-First Search** and **Depth-First Search**.
54+
* For **Depth-First Search**, there are two ways to make it: `Recursive` and `Iterative`. So I will provide 3 solutions in total.
55+
* Mark each found land as `V` which represents `visited`. Visited lands don't need to be visited again.
56+
1. After all lands on an island have been visited, look for the next non-visited land.
57+
1. Repeat the above steps until all the lands have been `visited`.
5958

6059
### Solution 1: 'Depth-First Search' by Recursion
6160
Please click [Depth-First Search by Recursion Solution](0200-number-of-islands.md) for `200. Number of Islands` to view.

problems/0200-number-of-islands.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,16 @@ And this graph may have multiple **connected components** (islands):
4545

4646
Finding the number of islands is to find the number of `connected components`.
4747

48-
Each island can be expanded from a point that is land until it cannot be expanded any further, and the island is traversed.
49-
Therefore, the visited land needs to be marked as `visited` and does not need to be visited again next time.
48+
Walk from one node to the adjacent node until all nodes on the island are visited.
5049

5150
## Steps
52-
1. Find the first land point.
53-
1. Find all the adjacent land points of it.
51+
1. Find the first land.
52+
1. Find all the adjacent lands of it.
5453
* There are two major ways to explore a `connected components` (island): **Breadth-First Search** and **Depth-First Search**.
5554
* For **Depth-First Search**, there are two ways to make it: `Recursive` and `Iterative`. So I will provide 3 solutions in total.
56-
* Mark each found land point as `V` which represents `visited`.
57-
1. After all lands on an island have been visited, look for the next non-visited land point.
58-
1. Repeat the above steps until all the land points have been `visited`.
55+
* Mark each found land as `V` which represents `visited`. Visited lands don't need to be visited again.
56+
1. After all lands on an island have been visited, look for the next non-visited land.
57+
1. Repeat the above steps until all the lands have been `visited`.
5958

6059
## Solution 1: 'Depth-First Search' by Recursion
6160
From this sample code bellow, you can see that starting from a node, through recursive calls, it goes up until it can't go any further, turns right, and continues up. The priority order of directions is `up, right, down, and left`.

0 commit comments

Comments
 (0)