- 3of 3 votes
Suppose that each row of an n x n array A consists of 1's and D's such that, in any- inevitablekris September 21, 2014 in United States
row i of A, all the 1's come before any D's in that row. Suppose further that the
number of 1's in row i is at least the number in row i+ 1, for i= 0, 1, ... .n - 2.
Assuming A is already in memory, describe a method running in O(n) time (not
O(n2) time) for counting the number of 1's in the array A.
| Report Duplicate | Flag | PURGE
Open Chat in New Window