| 1 | Start scanning grid | - | 0 | None | [
['1','1','0','0','0'],
['1','1','0','0','0'],
['0','0','1','0','0'],
['0','0','0','1','1']
] |
| 2 | Found land cell | (0,0) | 1 | (0,0) | [
['V','1','0','0','0'],
['1','1','0','0','0'],
['0','0','1','0','0'],
['0','0','0','1','1']
] |
| 3 | DFS marks connected land | (0,1) | 1 | (0,1) | [
['V','V','0','0','0'],
['1','1','0','0','0'],
['0','0','1','0','0'],
['0','0','0','1','1']
] |
| 4 | DFS marks connected land | (1,0) | 1 | (1,0) | [
['V','V','0','0','0'],
['V','1','0','0','0'],
['0','0','1','0','0'],
['0','0','0','1','1']
] |
| 5 | DFS marks connected land | (1,1) | 1 | (1,1) | [
['V','V','0','0','0'],
['V','V','0','0','0'],
['0','0','1','0','0'],
['0','0','0','1','1']
] |
| 6 | Continue scanning | (0,2) | 1 | No change | [
['V','V','0','0','0'],
['V','V','0','0','0'],
['0','0','1','0','0'],
['0','0','0','1','1']
] |
| 7 | Found land cell | (2,2) | 2 | (2,2) | [
['V','V','0','0','0'],
['V','V','0','0','0'],
['0','0','V','0','0'],
['0','0','0','1','1']
] |
| 8 | DFS marks connected land | (2,2) | 2 | (2,2) | [
['V','V','0','0','0'],
['V','V','0','0','0'],
['0','0','V','0','0'],
['0','0','0','1','1']
] |
| 9 | Continue scanning | (3,3) | 2 | No change | [
['V','V','0','0','0'],
['V','V','0','0','0'],
['0','0','V','0','0'],
['0','0','0','1','1']
] |
| 10 | Found land cell | (3,3) | 3 | (3,3) | [
['V','V','0','0','0'],
['V','V','0','0','0'],
['0','0','V','0','0'],
['0','0','0','V','1']
] |
| 11 | DFS marks connected land | (3,4) | 3 | (3,4) | [
['V','V','0','0','0'],
['V','V','0','0','0'],
['0','0','V','0','0'],
['0','0','0','V','V']
] |
| 12 | Finish scanning all cells | - | 3 | All connected lands visited | [
['V','V','0','0','0'],
['V','V','0','0','0'],
['0','0','V','0','0'],
['0','0','0','V','V']
] |