Understanding Max Heaps: Properties, Operations, and Complexity

School
University of Maryland, College Park**We aren't endorsed by this school
Course
CMSC 351
Subject
Computer Science
Date
Dec 12, 2024
Pages
3
Uploaded by MateJellyfish4266
oAl TV S 2] oW Vel ospu U E 1AM e TICY o WSt LTRpUL (o gpeu ) . s\/ & T Rpw ooy A\ A Py vt TP Jsewada 2yl ¢ W\OPQ M SU M 1| M| | NS0 ph _‘A_}?P () U N (2) M2, 1" 7' 2put K 2s0y3 w0 warp|up |0 aspalh 4] () ® Ty, PN o vappvp om oy Fapul 3580 'm.l, wyau 7\“_ ""’l-\- Spu U Wy (8D Y 1l(ng) Tl Xopud svy (@ §1) xod sy Ve 2 v ow w9 B |+ VO 'p SPnpu\ ey (B J1) v@PIMp sp veyy | 13y 00y P0U D § D 95 4 S2ul v {O{"? waop Q«uog'ze—q ‘300 [ Py s ey . 17y vi-| 1 ML) sa}eN pu| (@) au YW 1130 0 qau ¥ W e \w/‘{; 343\ —w‘.\.vo e 290 2y e e | M (200 1Y 8 P ram 1L U S K AR (e V1 G'Mw\ W0 Y Y W s”\’.\, cv\pwg ‘).\.7\"‘9 6) O 0 (1L30SVaH "'3 daud w7 Sdyar XWI Qnv §I3q) h-wmg 21314 0) WV 6T:8 20T ‘T YdIei ‘Aepuiy 10-€0-7C0C-TSEDSIND
Background image
GO A neae W] indeel 1S KU Ligh), AT Ve (i) In mhojth«\ wat leved B L\QL\. § qp (n \vels g0 0,1, Lign) (W Sps a node o inde § The ¥ o} lesels bha 'S led and e botom level, inclusive, Ugnd = L9 i) +| Max Heaps M deb: A ox heap T3 6 CRT 3n i T Vay i eads node e Kays in W child nedes (i} 3). fBi':t: ‘hv. +#< |h '\'k nodeo 2 o equl + Hr. entrd dis. ae allowed! Queston: (wven a CBT, Viow Can we cowert it toa MH? 17 o max heap! n % %) Aower: we'll v 6 2-sYep 10) \S, —_— O/Lég) Pmcd.wt! ) £ (&) moxheaply (o Plkcesdoun) S e e o uie it the propety et He child Mbirees ac a\mwlg max heaps. Soch as th3 node! v doa e ?o\loum\fl: dwap | lo(aesl cwld (,k = Sile, \\‘.cker\‘hr) ?n\l\‘ded st |cfl]¢r han o nodck key. Repat k] either e get b o leaf
Background image
N YN W - s ¥ - g Reteat Ut eithes e get b o ledf % A\T ot the \’4& 1S 2 bO‘\MGQ'l's children. MH O m 1 20 oo an rsue | Swa‘a w - Qgg - W skill heo an Roue! Swap wl . ) v %\ V\ou\‘\m’(\'s a MH! 19) ¢ N s Time prlw..’r, Best: 001) 3} ke 2 cald \aUs Worst: 0 (\gn) il we \mva Swayp all The lm5 ’deMlm () CM\W\.bm\'\me . steting T loest s e Ltk Wo calden: "Wl @ we go fom LIgnd 03,20 and an mochenpily o} eo.dn node. Tire Complely = Best: 0(») il e Stet w] Mo \MAP Wast = O(nlgn) ) AL{MO ndt Ve T gp all
Background image