It should be O(nlogn) in worst case because, selecting median as pivot means it will be always placed at the middle after applying partition algorithm.

The Gateway to Computer Science Excellence

0 votes

Consider a scenario of modified quick sort, where we have given an input sorted array A[1 .. . n], all elements of array are distinct and n >=3. Pivot is the median of set of 3 elements [First element, middle element, and last element]. What will be worst case time complexity of modified quick sort?

a.O($n^{2}$)

b.O(nlogn)

c.O($n^{2}$logn)

d.O(nloglogn)

a.O($n^{2}$)

b.O(nlogn)

c.O($n^{2}$logn)

d.O(nloglogn)

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.5k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.4k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.2k
- Non GATE 1.4k
- Others 1.4k
- Admissions 595
- Exam Queries 573
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 18

50,737 questions

57,271 answers

198,141 comments

104,783 users