@don..can u plz tell me how the complexity of this http://www.geeksforgeeks.org/find-number-of-islands/ is ROW*COL?
On Thu, Apr 11, 2013 at 4:35 PM, rahul sharma <[email protected]>wrote: > > M not getting matrix..is it adjacency....if simple 1 means connected > components then first wehave 3 ones..then in second line 3 ones form 1 more > island..hw in last row 3 islands are formed..these are 3 1 means three > independent nodes...m I ryt? > > On Thursday, April 11, 2013, Arpit Sood <[email protected]> wrote: > > islands are five as for each cell we assume all surrounding positions to > be connected... so if coordinates are (x,y) then it is connected to (x+1, > y), (x-1, y), (x+1, y+1), (x-1, y+1), (x+1, y-1), (x-1, y-1), (x, y-1), (x, > y+1 > > > > > > On Thu, Apr 11, 2013 at 9:35 AM, rahul sharma <[email protected]> > wrote: > >> > >> I didnt get..plz explain more...thnx > >> > >> On Thursday, April 11, 2013, Don <[email protected]> wrote: > >> > Reformatting to make it easier to see: > >> > > >> > 11000 > >> > 01001 > >> > 10011 > >> > 00000 > >> > 10101 > >> > > >> > In this case an "island" is any set of "1's" which are connected > >> > vertically, horizontally, or diagonally. > >> > So the five islands are > >> > > >> > 11000 > >> > 01002 > >> > 10022 > >> > 00000 > >> > 30405 > >> > > >> > Don > >> > > >> > On Apr 10, 4:34 pm, rahul sharma <[email protected]> wrote: > >> >> {*1*,* 1*, 0, 0, 0}, > >> >> {0, *1*, 0, 0, *1*}, > >> >> {*1*, 0, 0, *1*, *1*}, > >> >> {0, 0, 0, 0, 0}, > >> >> {*1*, 0, *1*, 0, *1*} > >> >> > >> >> Can anybody eplain how there are 5 islands in above matrix..thnx in > advance > >> >> > >> >> source:-http://www.geeksforgeeks.org/find-number-of-islands/ > >> > > >> > -- > >> > You received this message because you are subscribed to the Google > Groups "Algorithm Geeks" group. > >> > To unsubscribe from this group and stop receiving emails from it, > send an email to [email protected]. > >> > For more options, visit https://groups.google.com/groups/opt_out. > >> > > >> > > >> > > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups "Algorithm Geeks" group. > >> To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected]. > >> For more options, visit https://groups.google.com/groups/opt_out. > >> > >> > > > > > > > > -- > > Regards, > > Arpit Sood > > > > -- > > You received this message because you are subscribed to the Google > Groups "Algorithm Geeks" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected]. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
