import java.util.*;
public class BubbleSort {
public int[] bubbleSort(int[] a, int l) {
// write code here
for(int i = l-2;i>=0;i--){
for(int j=0;j<=i;j++){
if(a[j]>a[j+1]){
int temp = a[j] ;
a[j] = a[j+1];
a[j+1] = temp;
}
}
}
return a;
}
}
冒泡排序练习题
最新推荐文章于 2024-04-02 00:32:53 发布