Mergeable heaps

前言

    本文目的在于对几种构建可合并堆的方式进行总体比较;并对每种方式分别从伪代码,具体实现,消耗计算等三方面进行总结;以达到对该类型问题有较清楚的认识。

简介

     可合并堆是指对外提供以下接口的堆

  1. MAKE-HEAP( ) creates and returns a new heap containing no elements.

  2. 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.

  3. EXTRACT-MIN(H) deletes the element from heap H whose key is minimum, returning a pointer to the element.

  4. 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.


    In addition to the mergeable-heap operations above, Fibonacci heaps also support
    the following two operations:

  5. 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.

  6. DELETE(H, x) deletes element x from heap H.

实现方式总体比较

Mergeable heaps_第1张图片



参考文章

  1. 算法导论 第三版

  2. http://www.cnblogs.com/xuqiang/archive/2011/06/01/2065549.html

IN BUILDING

你可能感兴趣的:(算法,heap,TODO)