Question: Interview Question practice problem Suppose that you are given a sorted sequence of distinct integers {a1, a2, , an }. Design and analyze a divide-and-conquer
Interview Question practice problem
Suppose that you are given a sorted sequence of distinct integers {a1, a2, , an }. Design and analyze a divide-and-conquer algorithm to determine whether there exists an index i such at ai = i. For example, in {-10, -3, 3, 5, 7}, a3 = 3. In {2, 3, 4, 5, 6}, there is no such i.
Make sure to give the pseudocode for your algorithm and prove that it is correct. Give the recurrence relation for the running time for the algorithm and solve its recurrence relation.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
