Aspire's Library

A Place for Latest Exam wise Questions, Videos, Previous Year Papers,
Study Stuff for MCA Examinations - NIMCET

Previous Year Question (PYQs)



The Quicksort and randomized Quicksort procedures differ in: 
1. Selection of Pivot element 
2. Worst case time complexity 
3. Best case time Complexity 
4. Final Output





Solution

The difference between Quicksort and Randomized Quicksort lies mainly in the way the pivot element is chosen. Let’s analyze each option:

  1. Selection of Pivot element ✅

    • Quicksort: Pivot is chosen deterministically (e.g., always first element, last element, or middle element).

    • Randomized Quicksort: Pivot is chosen randomly (uniformly among available elements).
      → This is the key difference.

  2. Worst case time complexity ❌

    • For both, the worst case is still O(n²).

    • Randomization only reduces the chance of hitting the worst case often, but it does not eliminate it.

  3. Best case time Complexity ❌

    • Both have the same best case: O(n log n) (when pivot splits the array evenly).

    • Randomization doesn’t change the best case.

  4. Final Output ❌

    • Both produce the same sorted output.

    • Randomization only affects the process, not the final result.



Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

Ask Your Question or Put Your Review.

loading...