Skip to content

Commit 288c2f2

Browse files
author
Joseph Luce
authored
Update 200_number_of_islands.md
1 parent 02dfb11 commit 288c2f2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

leetcode/medium/200_number_of_islands.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 200. Number of Islands
22

3-
## Traditional DFS Recursive Solution
3+
## BFS Recursive Solution
44
- Runtime: O(N)
55
- Space: O(N)
66
- N = Number of elements in grid
@@ -16,10 +16,10 @@ class Solution:
1616
for x_index, x in enumerate(y):
1717
if (x_index, y_index) not in visited and x == '1':
1818
n_islands += 1
19-
traverse_islands_dfs_recursion(x_index, y_index, grid, visited)
19+
traverse_islands_bfs_recursion(x_index, y_index, grid, visited)
2020
return n_islands
2121
22-
def traverse_islands_dfs_recursion(x, y, grid, visited):
22+
def traverse_islands_bfs_recursion(x, y, grid, visited):
2323
if not within_bounds(x, y, grid) or (x,y) in visited or grid[y][x] == '0':
2424
return
2525
visited.add((x,y))

0 commit comments

Comments
 (0)