Optimal Binary Search Algorithm