retagged by
719 views
0 votes
0 votes

Let P be a QuickSort Program to sort numbers in ascending order using the first element as pivot. Let t1 and t2 be the number of comparisons made by P for the inputs {1, 2, 3, 4, 5} and {4, 1, 5, 3, 2} respectively. Which one of the following holds?

A

t1 = 5

B

t1 < t2

C

t1 > t2

D

t1 = t2

retagged by

1 Answer

0 votes
0 votes

T1>T2  as quick sort has worst case for ascending /descending ordered list.

T2 is average case

Related questions

0 votes
0 votes
1 answer
1
dhruba asked Jun 5, 2023
441 views
Consider performing QuickSort on an array of n distinct elements. What is the probability that no comparisons will be made between the smallest and largest element?a. 1/n...
0 votes
0 votes
0 answers
2