top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Searching for an element in a circular sorted array Explain detail?

+4 votes
286 views
Searching for an element in a circular sorted array Explain detail?
posted May 8, 2015 by Mohammed Hussain

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

we can skip half the elements of our array during our search process

the array is not random array but there are two sorted sub-arrays;

  1. Calculate mid position of the array.

  2. if start element is less than mid element
    then first half of array is sorted
    Do the Binary search in first half.

  3. if mid element is less than end element
    then second half of array is sorted
    Do Binary Search in second half.

  4. Repeat Step1 and Step2 for the unsorted part of array by adjusting start and end pointers respectively.

answer May 13, 2015 by Anwar
Similar Questions
+3 votes

In an "N" element integer sorted array, a particular elements is repeating "(N/2)+1" times. How much time it take to find the repeating element.

+1 vote

Given 3 sorted array of size x, y, z. what is the minimum time taken to find the kth smallest element in the merged sorted array.

+2 votes

1,1,2,2,2,6,6,6,7,7,7,7,7,7,7,8,8,9,9,9

Example:
Input = 1 Output=0 (First index of 1).
Input = 2 Output=2 (First index of 2).
Input = 6 Output= 5 (First index of 6).
Input = 7 Output= 8 (First index of 7).
Input = 8 Output=15 (First index of 8).
Input = 9 Output=17 (First index of 9).

...