Showing posts with label BinarySearch. Show all posts
Showing posts with label BinarySearch. Show all posts

February 25, 2016

Binary search tricks

Probably array is the most popular collection of data. Everyone have used, is using and will use it. If array is sorted, this means you can simplify your life while processing array. I want to share some simple, but effective trick with binary search algorithm.

Imagine you have sequence of N numbers which splits space for N + 1 segments. Two of them on the edges are infinite. For instance, this is fuzzy thermometer.