标签:order array str out sys OLE 优化 lse ++
int[] a={5,2,3,4,1,6,7,8,9}; boolean flag=true; int t=0; for(int j=0;j<a.length-1;j++) { for(int i=0;i<a.length-i-1;i++) { if(a[i]>a[i+1]) { t=a[i]; a[i]=a[i+1]; a[i+1]=t; flag=false; } if(flag==true) { break; } } }
System.out.println(Arrays.toString(a));
优化以后的冒泡
原文地址:https://www.cnblogs.com/lwd521/p/11450902.html