530 views
1 votes
1 votes

What is the running time of QUICKSORT when all elements of the array $A$ have the same value?

2 Answers

1 votes
1 votes
Total comparison =( n-1)+(n-2) +.....n

                                   =O(n²)

Quick sort will do worst case time complexity if array is already sorted ie O(n²)
0 votes
0 votes
All the Elements have same values ,treated as sorted therefore worst case complexity , ie O(n^2)

Related questions

0 votes
0 votes
1 answer
1
akash.dinkar12 asked Jun 27, 2019
1,075 views
Show that the running time of QUICKSORT is $\Theta(n^2)$ when the array $A$ contains distinct elements and is sorted in decreasing order.
0 votes
0 votes
2 answers
4