Mergeable heaps
A mergeable heap is any data structure that supports the following five operations,
in which each element has a key:
MAKE-HEAP./ creates and returns a new heap containing no elements.
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.
EXTRACT-MIN.H/ deletes the element from heap H whose key is minimum, returning
a pointer to the element.
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:
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.1
DELETE.H; x/ deletes element x from heap H.

Each node has two other attributes. We store the number of children in the child
list of node x in x:degree. The boolean-valued attribute x:mark indicates whether
node x has lost a child since the last time x was made the child of another node.
Newly created nodes are unmarked, and a node x becomes unmarked whenever it
is made the child of another node. Until we look at the DECREASE-KEY operation
in Section 19.3, we will just set all mark attributes to FALSE.

In detail, the CONSOLIDATE procedure works as follows. Lines 1–3 allocate
and initialize the array A by making each entry NIL. The for loop of lines 4–14
processes each root w in the root list. As we link roots together, w may be linked
to some other node and no longer be a root. Nevertheless, w is always in a tree
rooted at some node x, which may or may not be w itself. Because we want at
most one root with each degree, we look in the array A to see whether it contains
a root y with the same degree as x. If it does, then we link the roots x and y but
guaranteeing that x remains a root after linking. That is, we link y to x after first
exchanging the pointers to the two roots if y’s key is smaller than x’s key. After
we link y to x, the degree of x has increased by 1, and so we continue this process,
linking x and another root whose degree equalsx’s new degree, until no other root

that we have processed has the same degree as x. We then set the appropriate entry
of A to point to x, so that as we process roots later on, we have recorded that x is
the unique root of its degree that we have already processed. When this for loop
terminates, at most one root of each degree will remain, and the array A will point
to each remaining root.
The while loop of lines 7–13 repeatedly links the root x of the tree containing
node w to another tree whose root has the same degree as x, until no other root has
the same degree. This while loop maintains the following invariant:
At the start of each iteration of the while loop, d D x:degree.

Fibonacci Heaps的更多相关文章

  1. 一些鲜为人知却非常实用的数据结构 - Haippy

    原文:http://www.udpwork.com/item/9932.html 作为程序猿(媛),你必须熟知一些常见的数据结构,比如栈.队列.字符串.链表.二叉树.哈希,但是除了这些常见的数据结构以 ...

  2. .NET中的泛型集合总结

    最近对集合相关的命名空间比较感兴趣,以前也就用下List<T>, Dictionary<Tkey, TValue>之类,总之,比较小白.点开N多博客,MSDN,StackOve ...

  3. 【推荐】Data Structure Visualizations

    University of San Francisco    David Galles 功能:可视化数据结构&算法实现过程 网站地址  https://www.cs.usfca.edu/~ga ...

  4. [Algorithm] 如何正确撸<算法导论>CLRS

    其实算法本身不难,第一遍可以只看伪代码和算法思路.如果想进一步理解的话,第三章那些标记法是非常重要的,就算要花费大量时间才能理解,也不要马马虎虎略过.因为以后的每一章,讲完算法就是这样的分析,精通的话 ...

  5. 某Facebook工程师写的攻略。

    Chapter 1 Interesting read, but you can skip it. Chapter 2 2.1 Insertion Sort - To be honest you sho ...

  6. Programmer Competency Matrix--ref--http://sijinjoseph.com/programmer-competency-matrix/

    Note that the knowledge for each level is cumulative; being atlevel n implies that you also know eve ...

  7. JAVA工程师技能要求

    近期做了个JAVA工程师分类, JAVA工程师可能是市场上最多类的程序员:   初级JAVA工程师的基本要求 Good basic programming skills 良好基本编程技能 Founda ...

  8. 算法与数据结构(九) 查找表的顺序查找、折半查找、插值查找以及Fibonacci查找

    今天这篇博客就聊聊几种常见的查找算法,当然本篇博客只是涉及了部分查找算法,接下来的几篇博客中都将会介绍关于查找的相关内容.本篇博客主要介绍查找表的顺序查找.折半查找.插值查找以及Fibonacci查找 ...

  9. #26 fibonacci seqs

    Difficulty: Easy Topic: Fibonacci seqs Write a function which returns the first X fibonacci numbers. ...

随机推荐

  1. Linux系统命令 3

    1.vmstat命令监控系统资源[root@localhost ~]#vmstat [刷新延时 刷新次数] 例如:[root@localhost proc]#vmstat 1 3 2.dmesg开机时 ...

  2. Java解决异常之try、catch、finally、throw、throws&log4j记录日志步骤

    知识点一.多重catch引发多种类型的异常排列catch 语句的顺序:先子类后父类 发生异常时按顺序逐个匹配只执行第一个与异常类型匹配的catch语句二.异常分类异常分为运行时异常和检测异常运行时异常 ...

  3. python 运算/赋值/循环

    python3 中只有一个InputPython2 中的raw_input与python3中的input一模一样python3中input输出字符串类型int,float=数字类型//地板除 % 取余 ...

  4. 编码原则 之 Persistence Ignorance

    原文 The principle of Persistence Ignorance (PI) holds that classes modeling the business domain in a ...

  5. Learning-Python【12】:装饰器

    一.什么是装饰器 器:工具 装饰:为被装饰对象添加新功能 装饰器本身可以是任意可调用的对象,即函数 被装饰的对象也可以是任意可调用的对象,也是函数 目标:写一个函数来为另外一个函数添加新功能 二.为何 ...

  6. 【HNOI 2018】寻宝游戏

    Problem Description 某大学每年都会有一次 \(Mystery\ Hunt\) 的活动,玩家需要根据设置的线索解谜,找到宝藏的位置,前一年获胜的队伍可以获得这一年出题的机会. 作为新 ...

  7. spring cloud 版本号与 boot版本之间的对应关系(版本不对,会导致pom无法引入)

    版本号规则 Spring Cloud并没有熟悉的数字版本号,而是对应一个开发代号. 开发代号看似没有什么规律,但实际上首字母是有顺序的,比如:Dalston版本,我们可以简称 D 版本,对应的 Edg ...

  8. 20175317 《Java程序设计》第二周学习总结

    20175317 <Java程序设计>第二周学习总结 教材学习内容总结 第二周我学习了教材三四章的内容,了解了Java与C语言的相似与不同之处. 其中第二章学到了标识符与关键字.基本数据类 ...

  9. 深入理解Plasma(一)Plasma 框架

    这一系列文章将围绕以太坊的二层扩容框架,介绍其基本运行原理,具体操作细节,安全性讨论以及未来研究方向等.本篇文章作为开篇,主要目的是理解 Plasma 框架. Plasma 作为以太坊的二层扩容框架, ...

  10. php 中的秒杀

    控制器层 //秒杀 首先要判断库存 其次高并发 然后入库 public function goods_do() { $gid=input("get.gid"); $user_nam ...