Implementation of a binary-bisect