Deloitte interview question

Describe 3 flags algorithm and write out the code for binary search.