Snapsheet Interview Question

Write the binary search algorithm.