TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Killing quicksort

8 pointsby l0stmanover 15 years ago

1 comment

_deliriumover 15 years ago
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 未加载