retagged by
1,173 views
0 votes
0 votes
The median of n elements can be found in  O(logn) time.which one of the following is correct about worst case time complexity of quick sort,if always median is selected as pivot element?

a)O(logn)

b)O(n)

c)O(nlogn)

d)O(nloglogn)
retagged by

1 Answer

0 votes
0 votes
Since the time complexity of finding the median is O ( log n), it indicate the elements are sorted and binary search for finding the median has been applied.

Since the worst case of time complexity for taking pivot element as median the time complexity will ne O ( n log n)

Related questions

967
views
1 answers
1 votes
Ray Tomlinson asked Aug 9, 2023
967 views
Which of the following statement(s) is/are true?(a) Quicksort and merge sort are both examples of divide and conquer algorithms.(b) If we randomly choose a pivot element ...
873
views
2 answers
0 votes
2.3k
views
3 answers
1 votes
Jithin Jayan asked Dec 7, 2016
2,340 views
Suppose that the partition algorithm of quick sort always produce a 9-to-1 proportional split. Then the Running time of algorithm over an unsorted array of n-elements is ...
1.1k
views
1 answers
1 votes
Sambhrant Maurya asked Aug 6, 2018
1,132 views
After applying few passes of quick sort on a given array, the following output was obtained:1,10,5,8,25,44,55,30,70Then how many pivot elements are there in the above ou...