1.

Which of the following methods is the most effective for picking the pivot element?(a) first element(b) last element(c) median-of-three partitioning(d) random elementThe question was posed to me by my college director while I was bunking the class.My doubt is from Quicksort topic in portion Sorting of Data Structures & Algorithms II

Answer»

Correct option is (c) median-of-three partitioning

Explanation: Median-of-three partitioning is the BEST method for CHOOSING an appropriate pivot ELEMENT. Picking a first, last or random element as a pivot is not MUCH EFFECTIVE.



Discussion

No Comment Found

Related InterviewSolutions