20 Fibonacci Heaps

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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值