ShellSort
来源:互联网 发布:旅游市场数据 编辑:程序博客网 时间:2024/06/01 14:43
public class Main { /** 希尔排序 */ private static void ShellSort(int[] list) { int i, j; int increment = list.length; do { increment = increment / 3 + 1;/* 增量 */ for (i = increment + 1; i < list.length; i++) { if (list[i] < list[i - increment]) { list[0] = list[i]; for (j = i - increment; j > 0; j -= increment) {//找出要插入的位置 if (list[0] > list[j]) { break; } list[j + increment] = list[j]; } list[j + increment] = list[0];//插值 } } } while (increment > 1); } public static void main(String[] args) {// System.out.println("HelloWorld."); int[] a = {0, 10, 32, 1, 9, 5, 7, 12, 0, 4, 3}; StringBuffer sb = new StringBuffer(); ShellSort(a); for (int i = 0; i < a.length; i++) { sb.append(a[i] + " "); } System.out.println(sb); }}
0 0
- ShellSort
- ShellSort
- shellsort
- shellSort
- shellsort
- ShellSort
- ShellSort
- 【shellSort】
- ShellSort
- ShellSort
- shellsort
- shellsort
- Java ShellSort
- uva10152 ShellSort
- 10152 - ShellSort
- 10152 - ShellSort
- UVaOJ10152---ShellSort
- uva10152 ShellSort
- http://blog.csdn.net/liang12360640/article/details/50350648
- Introduction to The Design and Analysis of Algorithms (1)
- NBUT 1655 木块拼接【想不明白】
- 在Activity里显示列表(ListView的布局)
- 链接
- ShellSort
- PKU1038 Bugs Integrated, Inc. 状压DP
- 集体智慧编程——神经网络预测点击率-Python实现
- 对于已知二叉树的中序遍历和后序遍历如何求二叉树的的前序遍历
- 90. Subsets II LeetCode
- git常用命令及含义
- 谷歌浏览器cookies管理插件:EditThisCookie(据说能刷访问量)
- 【牛腩】HTML+CSS基础了解
- iOS开发之swift-总结点