4 ms·
The sleep sort only requires n operations. for x in "$@"; do (sleep $x; echo $x) &; done
by jedisct1 6y ago
The sleep sort only requires n operations.
for x in "$@"; do
(sleep $x; echo $x) &;
done
- bluGill 6y agoAlthough if your computer is slow compared to the size of the list this will not work due to race conditions. Still cleaver.
- ironmagma 6y agoComputationally, this (ab)uses the scheduler to do your sorting for you. So really the performance becomes whatever your scheduler’s performance is, probably heapsort time (O(n log n)).