People keep coming up with smart ideas, even though sometimes they might not be useful for scaling up. One such example is that of sleep sort, which works like a charm, albeit I highly doubt that it would work for a long array. It certainly won’t work for negative numbers. Whether it works for real numbers or not depends on the implementation. Here’s a simple Python script I wrote, taking from the original idea, that works for integers. The idea is simple – for each number in an array, read the number, spawn a new process, count to the number, and then print the number.
I am using multiprocessing, which is allegedly better than threading, because it side-steps the Global Interpreter Lock in Python by using subprocesses rather than threads.
Oftentimes in computing you just have to look at an idea and smile at its beauty, even if you won’t really ever use it in your work.