recategorized by
1,160 views
3 votes
3 votes
In QuickSort algorithm, which of the following statements is NOT true regarding the partition process?

a) Partition always divides the array into two non-empty subsets.

b) The element chosen as the pivot does not have to be the median of the array for the algorithm to be efficient.

c) After the partition, the pivot is in its final sorted position.

d) If the array is already sorted, partitioning can be done in O(1) time complexity.
recategorized by

2 Answers

0 votes
0 votes
Option D is correct,

Bcoz If quick sort is sorted then worst case is O(n^2), so its is not done inO(1)
0 votes
0 votes

Option D is correct 

T(n) = T(n-1) + T(n-k-1) + Cn  ...(This is recurrence relation of TC of quick sort)

therefore , worst case occurs when array is sorted , so the resulting partitions will have sizes of 0 and n-1 in each recursive call.

This leads to a recurrence relation where one partition has a size of 0, and the other partition has a size of n-1:

T(n) = T(0) + T(n-1) + Cn

       = O(n^2)

Related questions

718
views
2 answers
0 votes
Ajink123 asked May 10, 2023
718 views
Sort the following array using quicksort algorithm. [40,11,4,72,17,2,49]
9.1k
views
2 answers
6 votes
radha gogia asked Jul 15, 2015
9,128 views
Assume that a CPU can process $10^8$ operations per second. Suppose you have to sort an array with $10^6$ elements. Which of the following is true? 1. ... could take more than 2.5 hours while quicksort will always take less than 1 second.
901
views
1 answers
0 votes
sajalsjddn asked May 29, 2016
901 views
(A) Each one can simulate the other(B) The turing machines always halts which represents all C programs(C) The C programs that always halt can simulate all turing machines(D) All of the above
1.6k
views
1 answers
2 votes
Rahul Sahukar asked Mar 5, 2016
1,590 views
consider an array consisting of following elements in an unsorted order but 60 as first element 60,80,15,95,7,12,35,90,55 quick sort partition ... array integers is possible preserving the effect of first pass of partition algorithm are