1) Let A[1..n] be a sorted array of distinct integers, some of which may be negative. Give a recursive O(log n)algorithm that can find an index i such that 1 ≤ i ≤ n and A[i] = i, provided that such an index exists. This means that you need to give the algorithm first and then analyze it. 2) look at screen shot to solve question number 2
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |