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 66a28af commit 7250c4eCopy full SHA for 7250c4e
十大排序算法_Java/Heap.java
@@ -27,7 +27,7 @@ private void max_heapify(int[] nums, int root) {
27
if (left < n && nums[left] > nums[maxIndex])
28
maxIndex = left;
29
// 如果有右孩子,且右孩子大于父节点和左孩子,则将最大指针指向右孩子
30
- if (right < n && nums[right] > nums[maxIndex] && nums[right] > nums[left])
+ if (right < n && nums[right] > nums[maxIndex])
31
maxIndex = right;
32
// 如果父节点不是最大值,则将父节点与最大值交换,并且递归调整与父节点交换的位置。
33
if (maxIndex != root) {
0 commit comments