摘要: 堆排序(Heap):要讲堆排序之前先要来复习一下完全二叉树的知识。定义:对一棵具有n个结点的二叉树按层序编号,如果编号为i(0 = 0; i--) { adjust(array, i, array.length); }} private static void adjust(int[] array, int n, int size) { int temp = array[n]; // 先拿出数据 int child = n * 2 + 1; // 这个是左孩子 while (child array[child]) { child++; ... 阅读全文
posted @ 2013-08-15 08:42 孤~影 阅读(3491) 评论(6) 推荐(5) 编辑