Saturday, April 21, 2018

Binary Search, Limit Search, Bound Search and Range Query

Binary Search

Binary Search is the most efficient algorithm for searching in sorted array.

Implementation of Binary Search is pretty straightforward.

Lower Limit and Upper Limit

Binary search in a sorted list is straight forward. Binary search principle can also be applied to search for the lower limit and upper limit.

Lower Limit means the minimum index item, which is greater than or equal to the given search item.

Similarly, Upper Limit means the maximum index item, which less than or equal to the given search item.

Lower Limit

Upper Limit

Lower Bound and Upper Bound

Lower Bound means the minimum index item, which is greater than given search item.

Similarly, Upper Limit means the maximum index item, which less than given search item.

Lower Bound

Upper Bound

Test

Application of Limit Search

There can be several applications of these. One of the application could be using the lower and upper limit to find the number of items in the given range.







No comments:

Post a Comment