Question: 1. We consider the following problem: Given a sorted array of n distinct integers A[1,..., n] (where sorted means in the increasing order), you
1. We consider the following problem: Given a sorted array of n distinct integers A[1,..., n] (where "sorted" means in the increasing order), you want to find out whether there is an index i for which A[i] = i. (a) [5 marks] Design a divide-and-conquer algorithm that solves this problem in time O(log n). (b) [5 marks] Give an argument that your algorithm indeed has running time O(log n) by for- mulating an appropriate recurrence equation and solving it. (c) [3 marks] Give an argument that your algorithm is correct.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
