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.

Bead sort: faster than O(N log N) sort

27 pointsby zkzalmost 16 years ago

9 comments

amalconalmost 16 years ago
There are "sorting algorithms" faster than O(n log n); that limitation only applies to comparison sorts. These typically have complexity depending on the keyspace (for example, counting-sort has linear complexity in whichever is greater, the size of the input list or the keyspace).<p>They're also typically kind of useless, as in this example, because we rarely care to sort an arbitrary list of integers with no metadata. Radix-sort is a rare exception, in that it can easily be modified to carry metadata, hence people actually using it in some applications.
评论 #668246 未加载
jaydubalmost 16 years ago
<a href="http://en.wikipedia.org/wiki/Radix_sort" rel="nofollow">http://en.wikipedia.org/wiki/Radix_sort</a>
评论 #668422 未加载
bayareaguyalmost 16 years ago
Previously posted here <a href="http://news.ycombinator.com/item?id=257374" rel="nofollow">http://news.ycombinator.com/item?id=257374</a>
arsalmost 16 years ago
Is there any theory on analyzing sorting real world objects? Like playing cards.<p>In a computer, picking the n'th item in an array is O(1), in the physical world it's O(n). In a computer inserting an item is O(n), but in the physical world it's O(1).<p>Are there any good algorithms for sorting playing cards?
评论 #668389 未加载
karanbhanguialmost 16 years ago
I thought about this sort on my own a couple years ago, and I thought I'd discovered the most amazing thing in sorting :P<p>Not only did I realize I was beaten to the punch few years earlier, but also that efficiency is lost in implementation.
ralphalmost 16 years ago
The brightly coloured slides on CSP-style programming, using Occam, at <a href="http://www.cs.kent.ac.uk/teaching/08/modules/CO/6/31/slides/" rel="nofollow">http://www.cs.kent.ac.uk/teaching/08/modules/CO/6/31/slides/</a> include a O(n) "sort pump" starting on page 14 of <a href="http://www.cs.kent.ac.uk/teaching/08/modules/CO/6/31/slides/replicators.pdf" rel="nofollow">http://www.cs.kent.ac.uk/teaching/08/modules/CO/6/31/slides/...</a> that's also O(n) for space.<p>Those slides are an interesting read generally if you're not familiar with CSP/Alef/Limbo-style programming, despite the crufty Occam syntax.
prodigal_erikalmost 16 years ago
If you have to represent each value in unary, how can you even set up the input and read the results in less than O(N^2), much less carry out the "fall"?
stcredzeroalmost 16 years ago
<a href="http://en.wikipedia.org/wiki/Spaghetti_sort" rel="nofollow">http://en.wikipedia.org/wiki/Spaghetti_sort</a><p>The advantages of this sort:<p>1) It involves something ridiculous (in the CS context) like Pasta.<p>2) You have an excuse to play the theme from "The Good, The Bad, and The Ugly" in that section of the talk.
die_sektealmost 16 years ago
Now we will need extra hardware just to do sorting!