retagged by
487 views
2 votes
2 votes

retagged by

1 Answer

Best answer
3 votes
3 votes
Given answer is wrong! It will still remain $\Theta (n^{2})$ because  to make the space for an element at its correct position we have to move each element one by one in array.
If array is already sorted in descending order, there will be n(n-1)/2 shifts in wors case.
selected by
Answer:

Related questions

0 votes
0 votes
1 answer
1
Sabir Khan asked Aug 8, 2018
1,056 views
The minimum number of comparisons required to determine if an integer appears more than n/2 times in a sorted array of n integers is(A) (n)(B) (logn)(C) (log*n)(D) (1)
4 votes
4 votes
7 answers
2
pradeepchaudhary asked Jul 9, 2018
12,432 views
Q) Consider a sorted array of n numbers. What would be the time complexity of the best known algorithm to find a pair a and b such that |a-b| = k , k being a positive int...
2 votes
2 votes
1 answer
4