Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ea633ef

Browse files
【changed】修改部分解析
1 parent 43a8ac4 commit ea633ef

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

‎基础知识/(6)排序/(6)堆排序.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ package heapSort;
66
* ���������ӽ���±�ֱ�Ϊ2 * i + 1��2 * i + 2�����0����������ӽ���±�ֱ�Ϊ1��2��
77
*/
88
public class HeapSortTest {
9-
// �������Ľڵ�˳���ڽ��ѵ�ɦ������˹淶�Ե�����
10-
//��Ԫ��array[k]���������𲽵������νṹ
119
/*
1210
* ������L·����ɶ���������L·�ľ��ǰ������Ǹ���Ū��������ȥ��С���Ѿͷ�������
11+
* ��Ԫ��array[k]���������𲽵������νṹ
1312
*/
1413
public void HeapAdjust(int[] array, int parent, int length) {
1514
int temp = array[parent];// temp���浱ǰ�����
@@ -54,8 +53,6 @@ public class HeapSortTest {
5453
public void heapSort(int[] list) {
5554
// **����** ѭ��������ʼ�ѣ������ķ��ڶѶ�
5655
//�����һ���ڵ�array.length-1�ĸ��ڵ㣨array.length-1-1��/2��ʼ��ֱ�����ڵ�0������������
57-
//û�м�2�����
58-
5956
for (int i = (list.length-2) / 2; i >= 0; i--) {
6057
HeapAdjust(list, i, list.length - 1);
6158
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /