701
play

701 IScapegqattreesfg.ua a - rebuild it Time Olk ) , , ' tune - PowerPoint PPT Presentation

- , " t Example scapegoat Trees Recap : : : - seen many search trees - Arne Anderson ( 1989 ) p : Met - Galperin - Rivest 4993 ) - Restructure via rotation ' - Today rediscovered extended Q t : Restructure via i=l"


  1. - , " t Example scapegoat Trees Recap : : : - seen many search trees - Arne Anderson ( 1989 ) p : → Met - Galperin - Rivest 4993 ) - Restructure via rotation ' - Today rediscovered extended ⑨ Q t : Restructure via i=l" 4=3 - Amortized analysis ) rebuilding , ② - Ollogn ) for dictionary ④ sometimes rotation not ② - y possible ops amortized , , ② - Better Mem ¥ 2 ( guaranteed for find ) . . usage - . . tubeetrethi :%k%%% ¥ 701 IScapegqattreesfg.ua ⑨ §a - rebuild it Time Olk ) , , ' tune - - n overview : ¥ How to rebuild ? ¥ Insert : . as standard BST rebuild ( p ) : ' t . - same siiobrdeeetwaerteagicsf itdeprtachetsoearhcishpath Dek.tseaimea.std.net f " - - ' - ' - build subtree CA ) - of deletes is back - Ifnum - find unbalanced . |sRrfubrhildfybetreeY ¥ Im ) build subtree ( ACO . large rel .to . Kid ) : n - node - scapegoat rebuild entire tree ! - ifk - o return null - - rebuild this subtree - j ← Lklz ) ;x ← A median How ? Maintain n ,m ← o - hc-buildsubtreelAEO.j.IT ) as stdtsst Find : same Insert : htt ,mtt log .hn ? .7lgnDelete:mn-szn-YeIbfuiid - Tree heights

  2. - , :* . ! ÷÷÷÷ :* . .÷÷÷÷÷÷÷i÷÷ : , ⑤ : - T_ Details of Operations Example Insert : . I - htt ; Mtt fit ⑤ . 1120 IQ Init : - same as stdtsst but root ← null . h ← m ← o ' ④ , ⑨ keep track of inserted ⑤ Delete : TO ① node 's depth - d - Same ' ④ std DST j ⑨ % , as : ¥ ÷÷÷÷÷÷ . iii. - for each node p vnisoidtesdinsnjg.ly ? jjngeoftscapegozttreeswT ④ n 'll rial g > I § ¥ " - Lau - - l " proof : By contradiction - if sizecp . child ) Must there be Tip a ¥ . - Suppose p 's depth > . Pichi 'd catchiest .fi:92 ? ayg...:....)9og:dnenP.ofiedeg.thaniestor scapegoat ? yes ! logger - rebuild Lp ? ' nwwde V-ancestorsn-break-sjapegoat.rs but pc . binanymfd.ph , . . child )s Lemma : Given izelu a us , " www.e-ysjya.DK/sca-pegoatconditionJQo tree with D n nodes , if Ztsisizelu ) - o - n o ⇐ " ' has ? zssizecpk.FI - While backing out , traverse that satisfies 605 Q otp i " other sibling . ⇒ Eh )dsn ⇒ dsl0 $ %n , d > loyz.no/psfs)dn - Too slow ? No ! go → charge to rebuild . .

  3. - , t.ie#ttreeswMo ¥ 9 l e - e Theorem : Starting with an empty tree m dictionary - , . any sequence of operations a scapegoat tree take time on 0cm log m ) [ Amortized : OC login ) ] Proof : ( sketch ) O Clog n ) guaranteed [ Heights Olbgn ) ) Find : a rebuild Delete : In order to induce , number of deletes n number of nodes in tree . → Amortize rebuild time against . . . delete ops Insert : Based on potential argument n k ops to → It takes cause a subtree to size K to be unbalanced → charge rebuild time to these . operations ° ,

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend