Spaghetti Sort (2018)
advent.morr.cc
Spaghetti Sort (2018)
1–10 of 55 posts
Re: Spaghetti Sort (2018)
#2This is silly. The linear parts are just I/O, and the actual sorting happens in constant time by magic.
Re: Spaghetti Sort (2018)
#3So radix sort IRL.
Re: Spaghetti Sort (2018)
#4Isn't there also another IRL sorting algorithm that works with beads and gravity?
EDIT: I thought couldn't remember the name, turns out it's actually bead sort aka gravity sort. Sometimes things are as simple as they seem.
Re: Spaghetti Sort (2018)
#5This is silly. The linear parts are just I/O, and the actual sorting happens in constant time by magic.
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)
#6Linear time O(n) means that as you keep adding numbers to sort, the time taken is bounded by a linear function of how many numbers you have. Since there is an upper bound on the number of spaghetti strands you can hold in your hand, eventually you need to "Slam their lower sides on the table" in batches, and then merge sort the results. However because unlike in merge sort there is an upper bound on the size of the sub lists you use spaghetti sort will actually be O(n^2) instead of O(n log(n)).
If you ignore the usual meaning of linear time and restrict yourself to sorting lists of numbers that will fit in your hand, then spaghetti sort always runs in less time that however long it takes to sort the maximum amount of spaghetti you can hold in your hand. i.e. constant time.
Re: Spaghetti Sort (2018)
#7Has someone calculated at what n I will sort faster than my PC?
Re: Spaghetti Sort (2018)
#8So radix sort IRL.
[deleted]
Re: Spaghetti Sort (2018)
#9Has someone calculated at what n I will sort faster than my PC?
What are the specs of your PC? I think we need RAM, CPU cores, freq, and architecture.
Re: Spaghetti Sort (2018)
#10Has someone calculated at what n I will sort faster than my PC?
That better be some incredibly thin spaghetti you're holding in your massive hands.