Algorithms | Divide and Conquer | Question 6

Consider the problem of searching an element x in an array ‘arr[]’ of size n. The problem can be solved in O(Logn) time if.
1) Array is sorted
2) Array is sorted and rotated by k. k is given to you and k <= n
3) Array is sorted and rotated by k. k is NOT given to you and k <= n
4) Array is not sorted
(A) 1 Only
(B) 1 & 2 only
(C) 1, 2 and 3 only
(D) 1, 2, 3 and 4


Answer: (C)

Explanation: See https://www.geeksforgeeks.org/search-an-element-in-a-sorted-and-pivoted-array/

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.