How to arrange array in the order

over here it is said we are have to arrange the array in ascending order or descending order how to do that

@rishabh.chhabra10,
It means that the array on which you can apply binary search should either be sorted in ascending order or descending order.

You cannot apply binary search, on a non sorted array.

You will learn sorting in further modules, don’t worry :slight_smile:

but when i tried over this code and it was unsorted i got an output

@rishabh.chhabra10,
It won’t work on all the test cases. The binary search splitting property is dependent on the condition that the array should be sorted.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.