I don't want you to solve this problem for me, i just want to ask for some ideas.
This is the input below, and it represents a map. The 'x' represents land, and the dots - water. So with the 'x' you can represent 'islands' on the map.
xxx.x...xxxxx
xxxx....x...x
........x.x.x
..xxxxx.x...x
..x...x.xxx.x
..x.x.x...x..
..x...x...xxx
...xxxxxx....
x............
As you can see, there are some islands which are closed, i.e. if some boat is inside its territory, it won't be able to get out, for ex:
..xxxxx.
..x...x.
..x.x.x.
..x...x.
..xxxxx.
And there are some open islands which is possible to get out of them, ex:
.xxxxx
.x...x
.x.x.x
.xxx.x
The problem is this: For a given NxM map like those above, calculate howm any of the islands are open, and how many are closed.
I repeat: I don't want you to solve it, just need some sugestions, ideas for solving. thanks