6.2-2

来源:互联网 发布:网络数据抓取违法吗 编辑:程序博客网 时间:2024/06/05 06:28
MIN-HEAPIFY(A, i)  l = LEFT(i)  r = RIGHT(i)  if l ≤ A.heap-size and A[l] < A[i]      smallest = l  else      smallest = i  if r ≤ A.heap-size and A[r] < A[i]      smallest = r  if smallest ≠ i      exchange A[i] with A[smallest]      MIN-HEAPIFY(A, smallest)

显然二者复杂度是一样的

0 0
原创粉丝点击