0

I know that quick sort has an average case of O(nlogn). And I also know that the average case of comparison-based sorting algorithms are Omega of nlogn. Can we say that quick sort is the best sorting algorithm in average case compared to other comparison-based sorting algorithms? (I think the answer is yes. However, I cannot justify my answer with a convincing argument)

1 Answers1

1

Depends. Quicksort is not one algorithm. Performance depends on the details. You would adjust the algorithm slightly if moving items is expensive.

You might assume that items are in random order. That is often not the case. You may be able to sort items with non-random items faster than using quicksort. For example if an array starts or ends with many items in ascending or descending order sorting in linear time may be possible.

gnasher729
  • 32,238
  • 36
  • 56