Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Genius sorting algorithm: Sleep sort

Name: Anonymous 2011-01-20 12:22

Man, am I a genius. Check out this sorting algorithm I just invented.


#!/bin/bash
function f() {
    sleep "$1"
    echo "$1"
}
while [ -n "$1" ]
do
    f "$1" &
    shift
done
wait


example usage:
./sleepsort.bash 5 3 6 3 6 3 1 4 7

Name: kissrobber 2011-05-28 0:50

Hello.
I invented a new sorting algorithm in the Cloud age.
It's called the "Cloud Sort(Google App Engine TaskQueue Sort)".
http://d.hatena.ne.jp/kissrobber/20110527/1306508583

This use GAE TaskQueue(eta) instead of Sleep.
(http://code.google.com/appengine/docs/python/taskqueue/tasks.html)

Specifications:
・The order of the sort result is not guaranteed.
・Sometimes, a part of sorted data is duplicated.

Newer Posts