@atul: given a matrix just like above, (usually an image) the pixel values 
with similar can be searched for around the current pixel, and they all can 
be marked in one go,

think of an algorithm, which does the following

1) when a one is replaced by '2' manually, then algorithm changes every '1' 
that is adjacent to '2' in a recursive fashion.
2) now, how many times the manual involvement is needed.

assuming the algorithm spreads across diagonals too, then the below example 
has only one island, or as per my example, changing any one 1 to 2, will do 
the trick, 

1100
1100
0011

--> 1 islands, or 1 manual changes

1100
1100
0001

--> 2 islands, or 2 manual changes

1101
1101
1100
0001

--> 3 islands, or 3 manual changes

(if you didn't understand what a pixel filler is.. you can leave that for 
now.. its just one application of BFS)

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/DLCoXlVhNccJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to