Unverified Commit 30069baa authored by Asurx's avatar Asurx Committed by GitHub
Browse files

Update binary-heap.md

将二叉堆上移、下移代码中的下移代码修正为大根堆对应代码
parent 67135f26
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -62,8 +62,8 @@ up(x) {
down(x) {
  while (x * 2 <= n) {
    t = x * 2;
    if (t + 1 <= n && h[t + 1] < h[t]) t++;
    if (h[t] >= h[x]) break;
    if (t + 1 <= n && h[t + 1] > h[t]) t++;
    if (h[t] <= h[x]) break;
    swap(h[x], h[t]);
    x = t;
  }