Nme: ECE 608: Computtiol Models d Methods, Fll 005 Test # Mody, Octoer 3, 005! Your em should hve 0 (te pges.! Pge 9 is itetiolly left l.! Pge 0 cotis list of potetilly useful idetities tht you my use.! Write your me o this pge d t lest oe other pge.! Closed oo, closed otes.! Switch off d put wy cell-phoes/pgers! Apportio your time crefully.! Numers i rcets represet poits for tht questio. Poits dd up to 00.! Good luc. Pro. M. Score I 5 II 0 III 0 IV 5 V 30 VI 0 Totl 00 Pge of 0
Nme: I. (5 poits Ctegorize the followig sttemets s True or Flse.. The summtio is lower-ouded y the followig itegrl: lg( lg( 9 d 0 for ll 5.. The worst-cse compleity of BUILDHEAP is O ( lg. i i c. If T (, for some costt positive iteger i, the T ( Θ( d. There my eist compriso sort lgorithm whose worst-cse symptotic time compleity is give y the followig recurrece: 73 l( T ( T, > d T (,. 34 e. HEAPSORT d QUICKSORT hve ideticl symptotic time compleity i the worst cse. II. (0 poits Prove usig iductio tht if f cf ( is true whe, >, > d f( is symptoticlly positive fuctio of, the i i f c f ( i lso holds true for ll i power of.. Assume tht is ect Pge of 0
Nme: III. (0 poits Summtios d Recurreces.. (7 poits If c f ( where is costt, prove tht. > 0 c ( ( f Θ. (3 poits Is the Mster method suitle/pplicle to derive the symptotic compleity of the followig recurrece? If so, stte the symptotic compleity. If ot, stte why the method is ot pplicle. >,, 3 ( T T Pge 3 of 0
Nme: IV. (5 poits Arrge the followig fuctios i icresig order of symptotic compleity. If multiple fuctios re of equivlet compleity OR if certi fuctios cot e compred with others i the list, your swer must stte it eplicitly.. T ( 0T Θ( 3. The worst-cse symptotic compleity of INSERT_SORT with - elemet iput c. si ( lg lg d. lg e. The worst-cse symptotic compleity of BUILDHEAP with -elemet iput. Pge 4 of 0
Nme: V. (30 poits A -ry tree is tree where ech verte my hve upto childvertices which re umered from to. By covetio, the child vertices re rrged from left to right i icresig order of umerig. (Note, iry-tree is -ry tree with d the first child leled s the left child d the secod child leled s the right child. We defie -ry MAX-HEAP s - ry tree tht stisfies the followig two properties: (i Nerly-complete property: All o-lef vertices, ecept for possily oe, hve childre. If o-lef verte hs fewer th childre (which must ll e left-most childre, it is the right-most verte t tht depth with childre. Fig illustrtes erly-complete 3-ry tree. (ii M-Hep property: The ey of the pret must e greter th or equl to the ey of the child. Fig : Nerly-complete 3-ry tree The -ry hep is to e stored i rry. Provide the pseudocode for the followig -ry hep mipultio primitives. (Hit: Sice the trditiol iry hep is specil cse of the -ry hep, you c verify the correctess of your pseudocode y testig it with.. (5 poits JTH-CHILD(i,j, : Returs the ide of the j th ( j child of verte i i -ry hep. Hit: It my e esier to derive the reltioship etwee pret d its th (i.e., right-most child. The ide of other child odes my e clculted usig offset from the th child. Your code eed ot iclude error hdlig to chec for ivlid rgumets. Pge 5 of 0
Nme:. (5 poits PARENT(i, : Returs ide of the pret of verte i i - ry hep. c. (0 poits KARY-MAX-HEAPIFY(A, i, : This fuctio must restore the hep property i -ry m-hep (cotied i rry A i which oly the i th elemet violtes the hep property. You my use the PARENT( d JTH-CHILD( primitives developed i prts ( d ( ove. Pge 6 of 0
Nme: d. (0 poits BUILD-KARY-MAX-HEAP(A, : This fuctio must uild hep from uordered list of elemets supplied i the rry A. You my use the PARENT(, JTH-CHILD(, d KARY-MAX-HEAPIFY( primitives developed i prts (, ( d (c ove. Pge 7 of 0
Nme: VI. (0 poits The ECE 608 clss hs developed ew versio of PARTITION clled PARTITION608 with the followig properties. Whe the iput rry cotis t lest 7 (608* elemets, PARTITION608 selects the pivot elemet such tht ech prtitio hs t lest 608 elemets. Whe the iput rry is smller th 6, PARTITION608 returs the ide of medi of the rry s the pivot resultig i eve split. PARTITION608 rus i lier time. QUICKSORT608, mior modifictio of QUICKSORT, ivoes PARTITION608 isted of the sic PARTITION fuctio. The recursio termites whe QUICKSORT608 is ivoed o sigle-elemet rry.. (5 poits Let T( e the symptotic worst-cse time compleity of QUICKSORT608. Epress T( s recurrece.. (5 poits Solve the recurrece otied i ( to derive symptotic tight ouds for the worst-cse time compleity of QUICKSORT608. Pge 8 of 0
Nme: Pge 9 of 0
Nme: Pge 0 of 0 Potetilly Useful Idetities d Approimtios ( ( Θ Ο < e m m m m m c c e! 4 ( 6 ( ( ( ( l(,. lg(lg( lg lg (lg lg l lg 3 0 0 π