Consider an array ‘A’ with 2m elements. The elements in odd position are sorted in non-increasing order that is A[1] >= A[3] >= A[5]......A[2m-1] The elements in even position are sorted in non-decreasing order, that is A[2]<= A[4] <= A[6].....A[2m]. Which of the following method is recommended for finding if a given number is in array?
- Sort the given array using quick sort and then apply binary search on array.
- Merge the sorted lists and apply binary search.
- Apply binary search on the entire array.
- Separately apply binary search on the odd position elements and even position elements
i thought answer would be B,cuz then O(n) time will be taken but answer is D.how can we apply binary search on odd and even seperatly..pls guide me