News for hackers. Stuff that matters.
Re:Spaghetti Sort (2018) by ziofill on Sunday September 29, 2019 @06:27AM (#21106243)
This is silly. The linear parts are just I/O, and the actual sorting happens in constant time by magic.
Re:Spaghetti Sort (2018) by empath75 on Sunday September 29, 2019 @06:37PM (#21110048)
The sorting doesn’t happen in constant time. The actual sort happens by hand as you take out the largest pieces first. Until you do that, they aren’t in linear order.
Re:Spaghetti Sort (2018) by jakear on Sunday September 29, 2019 @10:23PM (#21111244)
They are linear in order – from the top. The final step is simply reformatting the results.
Re:Spaghetti Sort (2018) by fenomas on Monday September 30, 2019 @12:55AM (#21111882)
They're not in order, they're just in a data structure where the largest remaining element can be extracted in O(1) time. One can't say anything useful about any other elements of the list.
Re:Spaghetti Sort (2018) by krajzeg on Monday September 30, 2019 @06:36AM (#21113543)
It's fun to think about: you have a structure which allows you to iterate all elements in order in O(n) time. Isn't this in many ways equivalent to the structure being "sorted", even if it doesn't have all the properties of a sorted array (like being able to get the nth element in O(1))?

For example, a sorted linked list behaves almost exactly like this spaghetti column.

Re:Spaghetti Sort (2018) by s_gourichon on Thursday October 03, 2019 @02:48PM (#21150584)
Interesting remark. So, a "data structure where the largest remaining element can be extracted in O(1) time" can be turned into a sorted list in O(n) time.

So, under the assumtions, the overall algorithm does complete in constant time.

Re:Spaghetti Sort (2018) by c3534l on Monday September 30, 2019 @12:33AM (#21111797)
> This is silly.

We know. No one is proposing this be used to actually sort. It's funny because it is a linear time algorithm, but incredibly inefficient and impractical in real life.

Re:Spaghetti Sort (2018) by wubblebubble on Monday September 30, 2019 @10:54AM (#21115988)
i've actually implemented a similar spatial-sort method used within an analog computer for some industrial controllers. so it does have some real life applications.
Re:Spaghetti Sort (2018) by s_gourichon on Saturday October 05, 2019 @06:46AM (#21164832)
The traditional mechanical systems in automatic vending machines that tell and sort correct coins from wrong or fake ones are probably of the same class of mechanical "sorting" (rather categorization in this case) systems. "Mechanical coin acceptor" appears to be the established expression for it.