Pergunta de entrevista da empresa Qualcomm

Sorting and searching for an element in an array the best way