edited by
1,238 views
1 votes
1 votes

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?

edited by

1 Answer

0 votes
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.

Related questions

2 votes
2 votes
1 answer
1
yes asked Oct 6, 2015
1,331 views
for example array contain a[1 2 3 3 3 3 3 4 5] then retun(1)
8 votes
8 votes
2 answers
2
0 votes
0 votes
2 answers
4
dhruba asked Jun 5, 2023
1,094 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). ...