3 ms·
I remember reading a book about analogue computation, and one fun fact stuck in my teenage brain - you can build a sort 'algorithm' that always takes only one o
by PlunderBunny 2y ago
I remember reading a book about analogue computation, and one fun fact stuck in my teenage brain - you can build a sort 'algorithm' that always takes only one operation. For every 'number' that you want to sort, cut a piece of uncooked spaghetti to a length that represents the number. Take the pieces of spaghetti and hold them loosely in your hand parallel to each other. Then bang one end down on the table, and they will all be at the same position on the table end. Read the resulting order of the numbers from the other end.
Someone could argue that cutting/labelling all the pieces of spaghetti takes considerably more time. I'm sure we are all capable of seeing past such a boring technicality.
The book described how big a pile of spaghetti would need to be to sort large numbers, and I'm afraid I can't remember any of the details, but there's a certain point where you need to bang the pile of spaghetti against something the size of the moon.