算法实现系列第一章.冒泡排序
程序员文章站
2022-06-05 16:29:11
...
package algorithm; public class Bubbling { public static void main(String[] args) { int[] ints = {123,1,31,31,432,42,1,23,556,75,67,76,8,6} ; int temp = 0 ; for (int i = 0; i < ints.length; i++) { for (int j = i; j < ints.length; j++) { if(ints[i]<ints[j]){ temp = ints[i] ; ints[i] = ints[j] ; ints[j] = temp ; } } } for (int i = 0; i < ints.length; i++) { System.out.println(ints[i]); } } }不要问不解释.
上一篇: 前端基础进阶(二):执行上下文详细图解
下一篇: RHEL下安装MySQL