Given a sorted array of distinct integers A[1...n], we want to find out whether there is an
Fantastic news! We've Found the answer you've been seeking!
Question:
Given a sorted array of distinct integers A[1...n], we want to find out whether there is an index i for which A[i] = i. Give a divide-and-conquer algorithm that runs in time O(log n). (Hint: use the divide-and-conquer approach as in the binary search algorithm)
Related Book For
Probability & Statistics for Engineers & Scientists
ISBN: 978-0130415295
7th Edition
Authors: Ronald E. Walpole, Raymond H. Myers, Sharon L. Myers, Keying
Posted Date: