本文目的在於對幾種構建可合併堆的方式進行整體比較;並對每種方式分別從僞代碼,具體實現,消耗計算等三方面進行總結;以達到對該類型問題有較清楚的認識。html
可合併堆是指對外提供如下接口的堆算法
MAKE-HEAP( ) creates and returns a new heap containing no elements.this
INSERT(H,x) inserts element x, whose key has already been filled in, into heap H. MINIMUM(H) returns a pointer to the element in heap H whose key is minimum.spa
EXTRACT-MIN(H) deletes the element from heap H whose key is minimum, returning a pointer to the element.htm
UNION(H1;H2) creates and returns a new heap that contains all the elements of
heaps H1 and H2. Heaps H1 and H2 are 「destroyed」 by this operation.blog
In addition to the mergeable-heap operations above, Fibonacci heaps also support
the following two operations:接口
DECREASE-KEY(H, x, k) assigns to element x within heap H the new key
value k, which we assume to be no greater than its current key value.ci
DELETE(H, x) deletes element x from heap H.element