Tapad interview question

Implement a binary search algorithm from the beginning.