Quicksort- how pivot-choosing strategies affect the overall Big-oh behavior of quicksort?

后端 未结 3 720
甜味超标
甜味超标 2021-02-10 00:43

I have came up with several strategies, but I am not entirely sure how they affect the overall behavior. I know the average case is O(NlogN), so I would assume that would be in

3条回答
  •  终归单人心
    2021-02-10 01:11

    You have to understand that there are already many algorithms that will allow you to sustain a O(nlog(n)) complexity. Using randomized quick sort has expected time complexity of O(nlog(n)), and is usually considered better than other approaches.

    You would be able to sustain O(nlog(n)) if you would a mix of all above, i.e. conditionally apply one of them based on the "profile" of your input data set. That being said, categorising an input data set in itself a challenge. In any case, to do any better, you have to research on your input data set and choose on the possible alternatives.

提交回复
热议问题