• edited by
3,210 views
1 1 vote

In a sorted array, every element is repeated more than once except one. what will be the time complexity to find that element in the worst case?

1 Answer

0 0 votes
My ans is O(N)

we can not apply binary search here  because after divided  in binary search we should clearly know that which direction we go further either right  of left but here it is not possible element can be present in both direction. so we have to apply linear search to find that element.

Here question is little bit tricky because  in given question array is sorted. but array is sorted it does not mean that we have to apply binary search for finding element.
Position:
Show:

Related questions

2 2 votes
1 1 answer
2.2k
2.2k views
yes asked Oct 6, 2015
2,191 views
for example array contain a[1 2 3 3 3 3 3 4 5] then retun(1)
9 9 votes
2 answers 2 answers
23.4k
23.4k views
0 0 votes
2 2 answers
4.5k
4.5k views
0 0 votes
2 2 answers
1.9k
1.9k views
dhruba asked Jun 5, 2023
1,889 views
Binary search is performed on a sorted array of n elements. The search key is not in the array and falls between the elements at positions m and m+1 (where 1 ≤ m < n). Ho...