Binary Search in Unbounded array.
Following is simple algorithm for above problem.
Step 1: Locate lower and upper bound using jump at every 2^k location
Step 2: Do binary search within located bounds.
Step 2: Do binary search within located bounds.
Following is implementation of above algorithm in c++ language.
Please write comments if you find anything wrong or you want to add something more related to this topic.
No comments:
Post a Comment
Write your comment here.