20 Fibonacci Heaps

本文详细介绍了斐波那契堆的数据结构及其操作原理。包括其内部表示方式、优势及如何实现基本的合并堆操作等。通过对斐波那契堆特性的深入探讨,帮助读者理解这种高效数据结构的应用场景。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. Structure

  • a collection of min-heap-ordered trees.
  • not constrained to be binomial trees.
  • trees with Fibonacci heaps are rooted but unordered.(rootlist is not ordered)

Representation of Fibonacci Heaps

  • p[x] to its parent
  • child[x] to any one of its children(only point to one children)
  • left[x] to left sibling(circular, doubly linked lists)
  • right[x] to right sibling (circular, doubly linked lists)
  • degree[x] the number of children in the child list of node x
  • mark[x] indicates whether node x has lost a child since the last time x was made the child of another node.
  • min[H] minimum node

Advantage of doubly linked lists:

  • remove a node from a circular, doubly linked list in O(1) time
  • concatenate two such lists into one circular, doubly linked list in O(1) time.

Potential function        P(H)=count(root) + 2* count(marked)

 

2. Mergeable-heap operations

*Do not need to consolidate the trees within the Fibonacci heap except extract min. Delay work as late as possible

  • make-heap
  • insert: make a new node and add it to rootlist
  • minimum
  • union: concatenate the root list of two heap and then change minimum if necessary
  • extract-min: remove min, add its children to root list, merge same degree trees??why need to consolidate
  • decrease key: if decreased is bigger than its parent, complete. else add this subtree to root list, unmark this node. If its original parent is unmarked, mark it. else cut it add to root list, recursively does this to the ancestor on the path to the root.(If an marked node added to root list, it is unmarked) If the parent is already in root list, no need to mark. ??amortized cost
  • delete: decrease key to smallest,  extract-min
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值