BINARY SEARCH NOT WORKING PROPERLY

because the question said You can assume that the array is sorted, you code fails for finding 1 in 5 4 3 2 1.
Your code is correct