————— 第二天 —————
public static void sleepSort(int[] array){ for (int num : array) { new Thread(() -> { try { Thread.sleep(num); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(num); }).start(); }}public static void main(String[] args) { int[] array = {10,30,50,60,100,40,150,200,70}; sleepSort(array);}
}
————————————
![](https://uploa
d-images.jianshu.io/upload_images/24099992-8cac38496ed40c3c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
(小灰把自己的代码给大黄展示了)
2.猴子排序
或许这样说比较抽象,让我们来演示一下:
3.珠排序