O(m+n). Search from rightmost top corner. Count the no of zero from right and go to left, i.e. traverse through columns from right of the first row. When you find a column having 0, go down to lower row. Check the correspondent column is 1 or not. If it is, follow the above step or else go down to next lower row.
On 24 December 2010 16:02, MAC <[email protected]> wrote: > updated :) > > Given a boolean matrix with all the true elements on left side in the row >> so that each row can be broken into two parts left part containing only true >> elements and right part containing only false elements. Find the row with >> max number of true elements in it. >> >> >> 00011 >> 01111 >> 00001 >> >> true is 0 false is 1 .. so we will say 2nd row has maximum 1 and 3rd row >> has mximum 0 >> >> -- >> thanks >> --mac >> >> > > > -- > thanks > --mac > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- regards, soumya prasad ukil -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
