java实现插入排序

public class InsertSort implements SortUtil.Sort{

     public void sort(int[] data) {

        int temp;

        for(int i=1;i<data.length;i++){

            for(int j=i;(j>0)&&(data[j]<data[j-1]);j--){

                SortUtil.swap(data,j,j-1);

            }

        }       

    }

}

posted @ 2011-12-04 22:57  chenchun  阅读(456)  评论(0编辑  收藏  举报