Suppose that each row of an n x n array A consists of 1’s and 0’s such that, in any row of A, all the 1’s come before any 0’s in that row. Assuming A is already in memory, what is the complexity of the most efficient algorithm for finding the row of A that contains the most 1’s?
1
O(n2)
2
O(log n)
3
O(n)
4
O(n log n)