ejes consulting

Techincal Consulting Design and Automation

Archive for September 2011

New Sort? (kind of)

leave a comment »

One doesn’t find a new sorting algorithm floating around the internet very often, but here’s one that I found that’s actually kind of neat.

It’s not really very practical, but it’s still very fun. It’s quite simple. For each element of the array, you fork a new process which sleeps it’s value in seconds then displays that number. Repeat for the entire array.

function f() {
    sleep "$1"
    echo "$1"
while [ -n "$1" ]
    f "$1" &

found here!

Written by ejes

September 26, 2011 at 1:14 pm

Posted in Uncategorized