When does quicksort give worst performance?

1 answer

Answer

1232632

2026-05-09 02:10

+ Follow

Quicksort has its worst performance when the pivot selection consistently results in unbalanced partitions, leading to O(n^2) time complexity. This often occurs when the smallest or largest element is chosen as the pivot in a sorted or nearly sorted array. Such scenariOS can be mitigated by using techniques like median-of-three pivot selection or random pivoting to ensure more balanced partitions.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.