Algorithms
November 14, 2023Question 9890 – Time-Complexity
November 14, 2023Question 10146 – Time-Complexity
Quicksort is run on two inputs shown below to sort in ascending order taking first element as pivot,
(i) 1,2,3,...,n (ii) n,n-1,n-2,...,2,1
Let C1 and C2 be the number of comparisons made for the inputs (i) and (ii) respectively. Then,
Correct Answer: C
Question 5 Explanation:
Both are the worst cases of Quick sort, i.e., either the elements are already in increasing order or the elements are already in decreasing order.
So, option is (C) is correct.
So, option is (C) is correct.
C1 < C2
C1 > C2
C1 = C2
we cannot say anything for arbitrary n.
Subscribe
Login
0 Comments