Cognizant interview question

Write codes of Binary Search and Sorting