Is there any formula to calculate the no of passes that a Quick Sort algorithm will take?

不问归期 提交于 2019-12-24 06:00:15

问题


While working with Quick Sort algorithm I wondered whether any formula or some kind of stuff might be available for finding the no of passes that a particular set of values may take to completely sorted in ascending order.

Is there any formula to calculate the no of passes that a Quick Sort algorithm will take?


回答1:


Any given set of values will have a different number of operations, based on pivot value selection method, and the actual values being sorted.

So...no, unless the approximations of 'between O(N log(N)) and O(N^2)' is good enough.

That one has to qualify the average versus worst case should be enough to show that the only way to determine the number of operations is to actually run the quicksort.



来源:https://stackoverflow.com/questions/8623695/is-there-any-formula-to-calculate-the-no-of-passes-that-a-quick-sort-algorithm-w

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!