{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

1QCA0F99d01 - CSE 100 Midterm Examination W.A...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 6
Background image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CSE 100 Midterm Examination W.A. Burkhard April 24, 2008 __——___—______—__—__—————————-——-_ The principle of honesty must be upheld if the integrity of scholarship is to be maintained by an academic community. This means that all academic work will be done by the student to Whom it is assigned, without unauthorized aid of any kind. 1. This is a closed book examination. One handwritten study sheet is allowed; others will be removed with penalty. 2. Please check the examination immediately to ensure that your copy has all seven pages. 3. Put your name on all pages of the examination. 4. All questions have equal mark value. 5. Neatness counts. You must clearly show your work; take time to prepare a legible answer. Good luck and have fun! 005]? . Your signed study-sheet must be turned in with your examination. 9. Examinations written in pencil will not be considered for re-grade. 10. You may use a calculator; laptops and cellphones are not allowed. SOLuTtou student identifier name 3. ____._____. total Arrays (1 0 points) ‘ name 1.a A rectangular array int array [6] [14] appears Within a C program. What location function would the C compiler create for array? awfrlLCJ 1/» MJMQWCVXC) Wang = wr+c / 1.b A triangular array of integer values with coordinates 0 3 i0 S i1 3 i2 < 30 is implemented within a C program. What is the fewest number of consecutive integer values required to implement the array? W14. (302:1) :- LlcléO / 1.c Where is the integer value with coordinates (3, 3, 9) stored in this triangular array? “WMRM 4'» (cl—:1 + (it'll? = 1é5+6+3 : 1'74 ;— Topological Sorting ( 1 0 points) name . You are to rewrite, in C, a shorter version of the function TopSort. In this version, the function parameters are the success list array as well as the count array and n the number of items to be sorted. The List returned is to be as in the first homework. You may assume the successors and count arrays have been properly configured and initialized; that is, the successors [i] list contains those items that must follow 1 in the solution and count [1] is the number of items that precede item i. A copy of the List and the Int header files appears on the next page. List topSort ( List * successors , int * count , int n ) { 3 List Sobcfion) no'Pcmlccéssfis 3 , ‘mt 1,5; Int a g a : moi-LI” (°)3 Solwl'itm = mluth (sigeof—Inth, wefirn‘t’,h¢=‘rn‘t 33 ho?rcd¢0%$ors = Nah-2 List (“fit-Enta, Quaint) {(flt) é finCi=03 5,4)«3 in?) // bum noplulwsa ’n‘(pomttij ==o){ ' .3 «4»me“ (as); any; Head (umAuegos) 0L); , ELL 3 R+d~123l(no?rcclm~s,a)::mg ){ // 333$“ ‘umeeaM solmma) 5 i s DaluLIhtCau); tat—(5:03 :34 WU“ (sumorsfijlg 34+) { Mus-t (SWBJ) 0—) j) ; H; ( —-W[01L421M(m] ==C9) iWHe—adcmpruleccssocs a); j 3 }. {Cmust ( no (3le 5 WTM’QDQ ; ”1(Q. “fid‘w (MW) 2:" In) whom MW 3 21244; i Mmeomx; Mum/Was} -3- Havnw# A A qmpma . an“; V moahufiuoa nmmaoon A A Japan . pwwa V nmdm amoaoon A A Adana . pmfiq V mom nmeoon A A Japan . pmfiq V mop nmmaoon n A A gapaa A A qapma A A qmpmo A A Japan A A umpma A A gapmo A A pqfl . Japan \* mvonuwa Modpm A pmflq V HopmnopHpmHH pHpqu A A dunno . pHuqu V axozpmfia nmwaoon A A pmflq . pmflu V wpmnmumunoOPmfiH pmflq pmflq V Hfimampmfiwu pmflq V Hfiahpuwmnfl pmaq V HHMHmmwuuw pmfiq V unmmwpoflwu umfiq V cwmmpummnfi pmfiq V vmmmmmwuom nmmaoon nmmHoon nmmaoon qmeoon qmwaoon nmeoon A A an“; V pmflqapmnoa qu pmflq V pqummmuow qmeoon A A pmfiq V pmflqnmwao vwo> A A pmfiq V pwflquhu vHo> A A AVAmeH*V Uflo> . AVAhmoo*V * Uwo> . an V pquwxms pmfiq A qumflq * Uwo> A Adana * Uflo> A meq * Uwo> =n.Hoon= wvfiHunwu mIHmHA wnfiwovu :IHqu vadHH# mmvommp umuwmmp Hovmmhp \* * * * * * * * * * * * * * * * * * * * * * * * * 0Hfiw vamwn umfiq meow mnfiumm unmnxnsm was: wax» mung pqu * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ Macaw: A A unH V anw=Hm> pug A A vHo> V anHowNHm pm“ A A a an . a an V anmHHu pnfl A A qu V anmeH cwo> A A an V annmmn Umnmfimnn A A m unfi . AA an V anopmumn uHo> A A m paw V anwxma de A A n an . d PnH V anhmoo an A de * Ufio> wwvwmhp =A.Hoon= wUdaonwt HzH wdwwwfl¥ HzH Hwfinwfi# \* u u u n u u u u n u u u u u u u u u u u u u n u u u u * * moou mnflumm * * mmNHU PDH * * Open Addressing (10 points) name Here are the hash values of three records — 12, 32, 37 — to be inserted in the order given. 3.3 Where do the three records reside using Double Hashing? 32’ 3’7 3 $69 IIIII ’1. 0 1 2 3 4 1 ‘2. 3.b Where do the three records reside using Ordered Hashing QWWW Innmm 0 1 2 3 4 3.c Where do the three records reside using Brent Hashing? ~ IIII unwed W.» 0 1 2 3 4 32: 2. WW3 HI I7. 1 K BM soled: domk‘c. hashing / 3'7: 2 MW? [+7. no )2. Double Hashing Performance (10 points) name Here is a table containing four records. unmann- 0 1 2 3 4 5 6 4.3 What is the average successful search length? '5 «hut- $469 CO 8 t L “7 3 6 2- MW S 3\ 3 Z 1 6 ‘7 1+ 2/ l I ,7 5. W 2 '+ 3 l 3 /,_____._.. / 4.b What is the avirage unsuccessf1§ searchLlingth} s L l l l 8 (A l 1 £1 18 + 24 +3 2 g 33 L/ 2 ’ 4 7— L} 5 r ’2 . 0 4.c What are the expected unsuccessful and successful search lengths (expressions 0k)? EELS} :— %%(7/33 2” I'Lfg ,___————-——’ —NZ~)UOw—._N t It 25 3'+ #3 52: 61 SwF‘FIcien‘r 4101 04mm ELL—u] : “7/3 = 2V3 é?“ List Maintenance (10 points) name A “read-only” list containing five items with an associated access histogram array has been in use for some time. Using the histogram values, the access probabilities pi for the record in position i are estimated to be :01 = 1/4, p2 = 1/5 , p3 = 1/3, p4 = 1/20 and p5 = 1/6- 5.a What is the average number of items accessed to locate an item within the current list configuration? Wm Vt] +2/5+3/3 + q/w“ 5/é : (1540.9. +6O+f1+ 5’0)/60 '2 "V10 = 24750 = 2.623 5.b What is the optimal item arrangement as well as the expected number of items accessed to locate an item within the optimally arranged list? 5 Eopr = V3+ Z/Lf ‘+ 3/51’4/6+ [7.0 : (104301» 3e +40 + USU/60 : 2935— / 5.c What is our upper bound on the expected number of items accessed for the move to the front heuristic? EMTF é ZEvfiPr‘i : 30'70 M ...
View Full Document

{[ snackBarMessage ]}