by advisedwang · 5mo ago · 0 comments
for each element:
cut a spaghetti strand to the a the length of the elemnet
add strand to bundle of spaghetti
hold spaghetti bundle vertical
lower spaghetti bundle to a flat surface.
loosen grip so that each spaghetti strand comes to rest on flat surface
while there is spaghetti in the bundle:
lower a second flat surface above the bundle until it touches the topmost spaghetti piece
remove the piece, and output it's length
[1] which I learned about in "The New Turing Ominbus" by A K DewdneyThe common bound on sorting is you can't do better than O(n lg n) worst-case, but that is strictly only for comparison sorts anyway.
it is still O(n) weight to transport, so O(n^2) amortised; if you liken having a stronger hand that can carry more spaghetti to parallelisation, it's beaten by O(log^2 n) sorting algorithms on parallelised classical computers.