@Monty: Use an alternating across and down algorithm:

Set the current row = the first row
While current row is not the last row
    Look across the current row for the first false
    Look down the column containing that first false for a true
    If no such row is found, break. // current row is the result
End While

Since you only go to the right and down, you can't take more than m +
n steps.

Dave

On Dec 24, 5:46 am, monty 1987 <1986mo...@gmail.com> wrote:
> 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.
>
> if the size of matrix is m*n then it can be solved in O(m+n) time.
> Any bettar solution..........

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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