6.2-5

MAX-HEAPIFY(A, i)
  while i ≤ A.heap-size
      l = LEFT(i)
      r = RIGHT(i)
      if l ≤ A.heap-size and A[l] > A[i]
          largest = l
      else
          largest = i
      if r ≤ A.heap-size and A[r] > A[i]
          largest = r
      if largest ≠ i
          exchange A[i] with A[largest]
          i = largest
      else
          break
阅读更多
上一篇6.2-4
下一篇6.2-6
想对作者说点什么? 我来说一句

算法导论 练习题 6.2-5

1

niewei1986 niewei1986

2017-04-06 10:59:06

阅读数:396

没有更多推荐了,返回首页

关闭
关闭