find index of key for which cmp returns 0
The guaranteed performance is in O(log n) comparisons.
result is the index where cmp results in 0 or nil if no such index
was found in this array. In case several instance equal match,
the index of one matching key will be returned, but is not
specified which one.