Thursday, May 9, 2013

Find the index of the first element superior or equal to a value

A small algorithm to find the index of the first element superior or equal to the given value. The given sequence must be ordered. This tail recursive algorithm is inspired by the binary search algorithm.