希尔算法

for (int step = array.length / 2; step > 0; step /= 2) {

       for (int i = step; i < array.length; i++) {

           int temp = array[i];

           int j = i;

           while (j >= step && temp < array[j - step]) {

              array[j] = array[j - step];

              j -= step;

           }

           array[j] = temp;

       }

    }
posted @ 2013-11-20 17:49  寻找幸福的起点  阅读(181)  评论(0编辑  收藏  举报