We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 43a8ac4 commit ea633efCopy full SHA for ea633ef
基础知识/(6)排序/(6)堆排序.txt
@@ -6,10 +6,9 @@ package heapSort;
6
* ���������ӽ���±�ֱ�Ϊ2 * i + 1��2 * i + 2�����0����������ӽ���±�ֱ�Ϊ1��2��
7
*/
8
public class HeapSortTest {
9
- // �������Ľڵ�˳���ڽ��ѵ�ɦ������˹淶�Ե�����
10
- //��Ԫ��array[k]���������������νṹ
11
/*
12
* ������L·����ɶ���������L·�ľ��ǰ������Ǹ���Ū��������ȥ��С���Ѿͷ�������
+ * ��Ԫ��array[k]���������������νṹ
13
14
public void HeapAdjust(int[] array, int parent, int length) {
15
int temp = array[parent];// temp���浱ǰ�����
@@ -54,8 +53,6 @@ public class HeapSortTest {
54
53
public void heapSort(int[] list) {
55
// **����** ѭ��������ʼ�ѣ������ķ��ڶѶ�
56
//�����һ���ڵ�array.length-1�ĸ��ڵ㣨array.length-1-1��/2��ʼ��ֱ�����ڵ�0������������
57
- //û�м�2�����
58
-
59
for (int i = (list.length-2) / 2; i >= 0; i--) {
60
HeapAdjust(list, i, list.length - 1);
61
}
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments