大二上学习数据结构_第1页
大二上学习数据结构_第2页
大二上学习数据结构_第3页
大二上学习数据结构_第4页
大二上学习数据结构_第5页
免费预览已结束,剩余21页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Analysis Of Fibonacci HeapsMaxDegreeLet Ni = min # of nodes in any min (sub)tree whose root has i children.N0 = 1. N1 = 2.695Ni , i 1Children of b are labeled in the order in which they became children of b.c1 became a child before c2 did, and so on.So, when ck became a child of b, degree(b) = k 1.d

2、egree(ck) at the time when ck became a child of b = degree(b) at the time when ck became a child of b = k 1.bc1c2ciNi , i 1So, current degree(ck) = max0, k 2.So, Ni = N0 + (S0=q=i-2 Nq ) + 1 = (S0=q 1 = (S0=q 1.N0 = 1.N1 = 2.Ni = (S0=q 1.Ni = Fi+2 (1 + sqrt(5)/2)i , i = 0.MaxDegreeMaxDegree = logfn,

3、 where f = (1 + sqrt(5)/2.Accounting MethodInsert.Guessed amortized cost = 2.Use 1 unit to pay for the actual cost of the insert and keep the remaining 1 unit as a credit for a future remove min operation.Keep this credit with the min tree that is created by the insert operation.Meld.Guessed amortiz

4、ed cost = 1.Use 1 unit to pay for the actual cost of the meld.Remove Nonmin Element87316592867410495theNode695Remove Nonmin Element8731659286741095695Guessed amortized cost = 2logfn + 3.Use logfn units to pay for setting parent fields to null for subtrees of deleted node.Use 1 unit to pay for remain

5、ing work not related to cascading cut. Remove Nonmin Element8731659286741095695Keep logfn units to pay for possible future pairwise combining of the new top-level trees created.Kept as 1 credit per new top-level tree.Discard excess credits (if any).Remove Nonmin Element8731659286741095695Keep 1 unit

6、 to pay for the time when node whose ChildCut field is set to true is cut from its parent, and another 1 unit for the pairwise combining of the cut subtree.Remove Nonmin Element8731659286741095695Keep the 2 credits on the node (if any) whose ChildCut field is set to true by the ensuing cascading cut

7、 operation.If there is no such node, discard the credits.Remove Nonmin ElementGuessed amortized cost = 2logfn + 3.Use logfn units to pay for setting parent fields to null.Use 1 unit to pay for remaining work not related to cascading cut. Keep 1 unit to pay for the time when node whose ChildCut field

8、 is set to true is cut from its parent, and another 1 unit for the pairwise combining of the cut subtree.Keep logfn units to pay for possible future pairwise combining of the new top-level trees created.Remove Nonmin ElementPlacement of credits.Keep 1 unit on each of the newly created top-level tree

9、s.Keep 2 units on the node (if any) whose ChildCut field is set to true by the ensuing cascading cut operation.Discard the remaining credits (if any).DecreaseKey(theNode, theAmount)87316592867410495theNode695DecreaseKey(theNode, theAmount)10095873165928674695Guessed amortized cost = 4.DecreaseKey(th

10、eNode, theAmount)10095873165928674695Use 1 unit to pay for work not related to cascading cut. DecreaseKey(theNode, theAmount)10095873165928674695Keep 1 unit to pay for possible future pairwise combining of the new top-level tree created whose root is theNode.Kept as credit on theNode.DecreaseKey(the

11、Node, theAmount)10095873165928674695Keep 1 unit to pay for the time when node whose ChildCut field is set to true is cut from its parent, and use another 1 unit for the pairwise combining of the cut subtree. DecreaseKey(theNode, theAmount)10095873165928674695Keep the 2 credits on the node (if any) w

12、hose ChildCut field is set to true by the ensuing cascading cut operation.If there is no such node, discard the credits.Decrease KeyGuessed amortized cost = 4.Use 1 unit to pay for work not related to cascading cut. Keep 1 unit to pay for the time when node whose ChildCut field is set to true is cut

13、 from its parent, and use another 1 unit for the pairwise combining of the cut subtree.Keep 1 unit to pay for possible future pairwise combining of the new top-level tree created whose root is theNode.Decrease KeyKeep the 2 credits on the node (if any) whose ChildCut field is set to true by the ensu

14、ing cascading cut operation.If there is no such node, discard the credits.Remove MinGuessed amortized cost = 3logfn.Actual cost = 2logfn 1 + #MinTrees.Allocation of amortized cost.Use 2logfn 1 to pay part of actual cost.Keep remaining logfn + 1 as a credit to pay part of the actual cost of a future rem

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论