
java冒泡排序
public class BubbleSortExample {
static void bubbleSort(int[] arr) {
int n = arr.length;
int temp = 0;
for(int i=0; i < n; i++){
for(int j=1; j < (n-i); j++){
if(arr[j-1] > arr[j]){
//swap elements
temp = arr[j-1];
arr[j-1] = arr[j];
arr[j] = temp;
}
}
}
}
北京星誠視野網絡科技有限公司 © 2008-2022 京ICP備09003513-1號 技術支持:北京網站建設公司 北京APP開發