{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

5Q3260FAd01 - CSE 100 Midterm Examination W.A Burkhard...

Info iconThis preview shows pages 1–8. 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

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

View Full Document Right Arrow Icon
Background image of page 8
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 February 5, 2004 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 entire examination immediately to ensure that your copy has all eight pages. 3. Put your name on all pages of the examination. 4. All questions have equal mark value. 5. Neatness counts. 6. You must clearly show your work; take time to prepare a legible answer. 7. Good luck and have fun! 8. 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. WM oce or cleO login 1 7. 2 8 3 9 4 10. 5 11. 6. __.__—._ total Double hashing with passbits name 1. Insert the following sequence of key values into the empty table using double hashing with passbits. Your solution must show the passbit value for each location in the table after the final record is inserted. 012345678910 [flan-II...- Passbits “Ell-l...- data 37, 50, 12, 7, 29, 45, 24 Use the “standard” double hashing start and step functions and show both values for each key as well as indicating which record first changes the passbit from false to true. Key Start Step Passbit(s) first changed . from false to true 37 Ht 8 50 5 ‘ 12 1 3 7 '7 8 29 '7 l 0 r7} 6 45 I 6 l 24 "l 5 Z 2. The four records cat, dog, pig, sow have been inserted into the table using double hashing resulting in the arrangement shown. Five insertion orders are listed; determine for each whether that order would yield the configuration shown. 0 1 2 3 4 mafia. ammemymw b) sow, pig, dog, cat. yesE! or m’o cat: start 1, step 2 C) pig, cat , dog, SOW- yesED/ or Dno dog: start 2, step 3 . d 1 do cat sow. pig: start 1’ step 3 ) P g: g, ’ yesEEKor Dno sow: start 3, step 4 e) dog, Pig: cat : SOW- yes IE/or Elno Binary tree hashing name 3. Insert the following sequence of key values k0, k1, . . ., k5 into the empty table using binary tree hashing in order beginning with k0. Show your work especially the selection of the record(s) to be moved. 0 1 2 3 4 5 6 IIIAFEII K3 K5 K1 k0: start 1, step 3 k1: start 07 step 3 k2: start 3, step 2 k3: start 4, step 3 k4: start 6, step 2 k5: start 47 step 2 THE FIQ$T PM; RECozos ARE EALH A‘T‘ THEIR START PO§IrIDN$ 13sz K5 [as Hugging/D, ”THE ‘Tmee FOR K5 -- (#,Z,|) (6,1,1) ("‘7"ij (1.2.,5) (3,3, ‘9) / (3,155) (WP!) (1,1)0) (LI,3,H) (4,3,:1) (5,-1le EMPTY 4 Move K7, To sum— b Move K3 "T’D SL07‘ 3 INSERT KS‘ How SLOT” LIL, Binary tree hashing name This problem is concerned With the difference between double hashing and binary tree hashing. The following tree is logically built during an insertion using binary tree hashing. Double hashing builds no such tree but visits many of the some slots Within the table during the same insertion. The same table configuration exists for both double hashing and binary tree hashing for this insertion. 4.a Specify the meaning of left and right links Within binary tree hashing. LEFT LINKS WE Assocmflzo genera) Movgg ALONG; r13 ”b.6035 SHAME/veg, ON'E CMAWEQ: Rmm— LINK: T’HE RELORD w :H& THE—111% AT ”me Semen/4.59 SLur) 5Q ‘ 4 0093 0/05 PROBE EMRI Qtowa— Ir; P9083 SEQMENCE, Camp») ' ' » . . u , . <t+54<’/P,SW. ) , WP 1w) 1‘: 473% ) l ) Steffi \S STEP 0 P ‘PECDR-D AT S LOT t) 4.b Circle only those nodes that both double hashing and binary tree hashing will visit. Double hashing with passbits performance name 5. What are the average successful and unsuccessful search lengths for the following table? 0123456 F-F F T F T passbits ‘39 82 20 data The records were inserted in the order 39, 82, 20, and 25. Show your work. AVW SMCCfiSSFHL g EARLH '5: . O i \ \ I I I Aug/acre unwaessmr. l ' 1 l ‘ l ' SWLH : 2 l 1 1 1 l l } 7) l t \ 1 I l 30116: L73 5‘ 1 3 2 2 2. Z. #2 9‘ t 1 l I I I 6 2, 7. 7. 2 2, 7. 6. What are the expected successful and unsuccessful search lengths for the same table? Lemme» PAM—OR 0< = /7 EX PJECTED SMILE/swal— SMQCH LE/UGH : : [7/7, W (7/3) : 19:07?” Neeoeo Hgafi E XPHreo ww- Mccevsst 1. Swot—1r LIE/d (rm . v .y : LCZG 3w WW aw N -0- Arrays name 7. What is the fewest number of slots needed to implement the three-dimensional rectangular array? intxyz[18] [15] [20] ; numbm = l‘K-I’SZO = 51/00 610-65 8. Write a C function that implements the location function for the array in the question above. You may assume the parameters always satisfy 0 3 i0 < 18; 0 S i1 < 15; & 0 3 i2 < 20 and the array is implemented in row-major order. Row-major order means incrementing i2 by 1 changes the location by 1; your solution must run in constant time. unsigned location ( unsigned i0 , unsigned i1 , unsigned i2 ) { int lo C 5 ice: ’2,an l5’ak'LOj loc+= UXZO; YQIHNVM loc + 11 ’9 Passbit analysis name 9. A table has one passbit per slot. What is the probability a passbit is not set in the table when the load factor is a. at}: AT MO 31‘ 6L0“? ”DURING- “TH/S HAPPENS H’PA§33:7 MAINS FALSE ONE ’PRoBE Hrrs "THE TABLE CONS‘TKMCT‘ION’. [N‘H’H ’PROBABMTY I K IQ/ U -1 5K CI - 73) + Y\ n nga& n IS THE NMMBEA 0F Swv’s ONO/x) SEQUEAJCE LENGTH, mg KNOW FDA 'DomaLe HASWNG’ K/n : ‘Me("d) o THLN MSiNG— T745, "POISSON; ,APPp—UXMWOAJ (I‘vé‘yh x e'h/h 0 THE, “PROEsAGtMW 1g (1-090 —‘ ammo), Priority Queues — Floyd Williams implementation name 10. What tree structure does the following array represent? The array items satisfy the heap condition; the priority of an item is its position in alphabet/ dictionary order in reverse. 0 1 2 3 4 5 6 7 8 9 10 lflflmmwwwmw «um hm 11. Show the contents of the slots that differ after insertion of roc. U r1 Efiir‘iaf T7 C if} A ...
View Full Document

{[ snackBarMessage ]}