TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Killing quicksort

8 点作者 l0stman大约 15 年前

1 comment

_delirium大约 15 年前
I suppose this is why C++ uses introsort, which is basically a quicksort that churns for no more than O(n log n) steps before "bailing out" to a guaranteed O(n log n) algorithm like heapsort. That lets it get quicksort's in-practice-fast speeds on almost all inputs, while falling back to no worse than O(n log n) in the rare cases where quicksort would go quadratic (though it'll be worse in those rare cases, by a constant factor, than just running heapsort originally would've been).<p>edit: <a href="http://www.cs.rpi.edu/~musser/gp/introsort.ps" rel="nofollow">http://www.cs.rpi.edu/~musser/gp/introsort.ps</a>
评论 #1150337 未加载