冒泡排序练习题

来源:互联网 发布:精准医疗大数据平台 编辑:程序博客网 时间:2024/06/08 06:38
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;    }}

原创粉丝点击