Pregunta de entrevista de Cognizant

Explain binary search and write it's code