Diamond search algorithm.