3 min 0

java bubbling sort algorithm implementation

JAVA编程实现对数组{25.24.12.76.101.96.28}的排序。使用冒泡排序算法 importjava.util.Arrays; publicclassBubbleFinal{ publicstaticvoidmain(String[]args){ int[]arr={25,24,12,76,101,96,28}; sortFinal(arr); } publicstaticvoidsortFinal(int[]arr){ booleansorted=true; for(intj=0;j<arr.length-1;j++){ sorted=true; System.out.println(“第”+(j+1)+”趟\t”); for(inti=0;i<arr.length-1-j;i++){ if(arr[i]>arr[i+1]){ inttemp=arr[i];…
Read More