Credit where credit is due, I ran across this elsewhere a while ago and figured i’d give it a shot in C#, sadly I don’t remember where I saw  it, but either way I present to you a new awesome sorting algorithm.

private static void Sort(List integers)
        {
            foreach (int i in integers)
            {
                Thread t = new Thread(new ParameterizedThreadStart(display));
                t.Start(i);
            }
        }

        private static void display(object x)
        {
            int i = (int)x;
            Thread.Sleep(i * 100);
            Console.WriteLine(i);
        }

If all the stars align and your list is short enough this will sort properly!

*SHEERS*

 

Be Sociable, Share!

Tags: , , , ,