ServiceNow interview question

Explain binary search with code