大二上學(xué)習(xí)數(shù)據(jù)結(jié)構(gòu)_第1頁
大二上學(xué)習(xí)數(shù)據(jù)結(jié)構(gòu)_第2頁
大二上學(xué)習(xí)數(shù)據(jù)結(jié)構(gòu)_第3頁
大二上學(xué)習(xí)數(shù)據(jù)結(jié)構(gòu)_第4頁
大二上學(xué)習(xí)數(shù)據(jù)結(jié)構(gòu)_第5頁
已閱讀5頁,還剩21頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論