您的位置:首页 > 其它

{算法·SleepSort}

2011-07-03 09:04 337 查看
在一个网站上看到一个很搞笑的排序算法思想,下面是C#实现
using System;
using System.Threading;
namespace SleepSort
{
class Program
{
public static void Main(string[] args)
{
int [] nums={5,9,1,6,2,3,4,7};
foreach (int num in nums) {
(new Thread(sortThread)).Start(num);

}
Console.ReadLine();
}
public static void sortThread(object numo){
int num=Convert.ToInt32(numo);
Thread.Sleep(num*10);
Console.WriteLine(num);
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: