Created
October 26, 2009 20:05
-
-
Save flazz/218985 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env io | |
List do ( | |
pivot := method(first) | |
upper := method(select(x, x < pivot)) | |
lower := method(select(x, x > pivot)) | |
qsort := method(if(size > 1, lower qsort append(pivot) appendSeq(upper qsort), clone)) | |
) | |
writeln("building list") | |
a := list() | |
10000 repeat(i, a append(i asString)) | |
a shuffle | |
testSort := method( | |
a clone doMessage(call argAt(0)) | |
) | |
writeln("Testing") | |
for(i, 0, 3, | |
writeln("testQSort ", Date secondsToRun(testSort(qsort))) | |
writeln("testSort ", Date secondsToRun(testSort(sortInPlace))) | |
"" println | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment