First occurrence in a binary search
An addition to Jon Skeets post: The potential faster implementation is actually not hard to implement and adds only 2 lines of code, here is how I’d do it: if (midVal < key) low = mid + 1; else if (midVal > key) high = mid – 1; else if (low != mid) //Equal but … Read more