So I found this thing online that sorted integers by putting each one in a thread and sleeping for an amount of time based on that number, so I tried it out, and it worked!
Here's the (C#) code:
Code:
And here's the download:
http://merthsoft.com/SleepSort.exe
It works pretty well. I guess the complexity is O(kn) where k is the biggest number? I'd like to compare it to some other sorts and graph the results. If I get around to that, I'll post. Meanwhile, if you want to do the same, or show your implementations, or just talk about cupcakes, let's do that

Here's the (C#) code:
Code:
using System;
using System.Collections.Generic;
using System.Threading;
namespace SleepSort {
class SleepSort {
static void Main(string[] args) {
List<int> nums = new List<int>();
foreach (string s in args) {
ParameterizedThreadStart pts = new ParameterizedThreadStart(Sort);
Thread t = new Thread(pts);
t.Start(int.Parse(s));
}
}
static void Sort(object i) {
int a = (int)i;
Thread.Sleep(10 * a);
Console.WriteLine(a);
}
}
}
And here's the download:
http://merthsoft.com/SleepSort.exe
It works pretty well. I guess the complexity is O(kn) where k is the biggest number? I'd like to compare it to some other sorts and graph the results. If I get around to that, I'll post. Meanwhile, if you want to do the same, or show your implementations, or just talk about cupcakes, let's do that
