{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

6QAE698Cd01 - CSE 100 Midterm Examination W.A...

Info iconThis preview shows pages 1–6. 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
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 October 29, 1998 __________________________________.__—————————_————~————— 1. This is a closed book examination; one handwritten study sheet is allowed. 2. Please check the entire 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. r 6. You must clearly show your work; take time to prepare a legible answer. 7. Good luck and have fun!‘ * $0M?“ i ON oce or c5100 login 1 6. 2 ‘ 7. 3 8. 4 9. 5. ____._____._ total Table Data Type: Hashing name For the hashing problem, use the hashing functions h1(x)=x'/.11 and h2(x)=(x'/.10)+1 for a table of size eleven. . Insert the following sequence of key values into an empty table using double hashing with passbits. Your solution must show the passbit values for each location in the table after each record is inserted. 25, 49, 63, 14, 8, 44, 20, 47 Show your work here ., m \33: 15! 3: Ln: 5‘ e3: 8 ‘ H: 3 b s; 8 Cl 4%: 0 ”LG: 9 L17: 3 9 2. Why do passbits work so well for load factors approximately equal to 0.5? False Passhl-ls are like empty) slots “For unxmccess‘lwl searches) firmxmm4an5%e 3%rC/lrx. Plug WW3 \H‘Wl’ Yaw“ \Ffi‘t M»: W 24/ “fledged M an eta/43413 slot Ln, (Wk/L WvL€S. wl/U’xn VH¢,W ‘44,. “LBS Vt JAM) «a W at} Rh W‘ . com WM "/1.+’L WP” h. flt=tlo§€4+® m fie, lee/”HQ. < ‘LO‘L ‘IMOVOVH’VQ [AMSMCCGSY-AA/Q “Arc/Lu) -2- Table Data Type: Hashing name 3. What is the average unsuccessful search length for the following double hashing table with passbits? The key space is very large as usual. 02 Show your work here 1: h 1 ‘ 1 “Miami," 5; ME?” - J3}- 2: o l | I l l l 33 | \ l \ l l \ 4: '2. \ \ \ l x \ 5- . 3 z 3 2. z. 1 7. . l | l l l l \ ’6: L; a 2. 2. 2 3 2. a Table Data Type: Hashing name ____________._.__ For this hashing problem, use the hashing functions h1(x) = x Z 11 and h2(X) = ( x Z 10 ) + 1 for a table of size eleven. 4. Insert the following sequence of key values into an empty table using Ordered Hashing. 40, 38, 124, 23, 84, 111, 67 Show your work here M» m. ‘. HO: r1 1 3%‘0 5 [114° 3 23‘: 1 '-+ SW? '7 H12 1 672 :L 8 5. What improvement does Ordered Hashing provide? How is it obtained? unswccéss ; w L. 3 am; H LEN (I'M S. ORDERED \‘VASHIN C: {M’WKWES ORDERED HASHINQ. PflmNees {2&0er SLAQH THAT RM “VS \ANSmchsspuu SE/DJLCHi/NHEN EIUCOMNTLQINC-q. CO") V“ “@133 SEQwENLEl A SLc‘r‘ CONTFMNING; A smawm VALME ’T‘HA/x) THE DESK/LED VAvaE. EMT-WT»; snows tomTAw a \mnst SMALLER. THAN ANY PCS-“BUS KEY. Priority Queues name 6. What sequence of self-adjusting heaps results from inserting records with the following ranks into an initially empty tree. Show a self-adjusting heap after each insertion; heap order has the smallest record at the root. 15, 19, 35, 21, 10, 15, 80, 44 /fl_\_ ”‘\ la) @9 :3 s 3 IS a .5 .-.> “D 65’ “9’ ‘Igflé 35 ‘ \fi; 9 e ’3 7. What is the run-time for self-adjusting heaps? Assume the tree has at most 11 nodes. FOR F\ saswtuce c); INsatT A~1> FETCH OPERA¢|DMSJ THE W'OTr-xx. NMMEE THAN A OF COM'PAmSONS [5 NO GREATER 'L NHERE’Z RMGES OVE/L ”WE OPWTH’NS OF THi SEQUKEMCF; (ARM . 3 n1 '3 W55 3‘35 OF THE QESUH-TINCV TREE' AFTEQ. opal/emote 1‘ " Hash Tables name 8. Write a generic printTable method for your double hash table implementation in C,C++, or JAVA. In C++, assume this is a public member function; in C, assume the function has one argument — a pointer to the table; and in JAVA it should be a static public function within the table implementation. You may assume there is a “user supplied” showRecord method which displays a single instance of the record. Your table implementation has the parameter size which specifies the number of slots in the table. Your printTable routine should provide the following items as output for each slot in the table: the slot number, the data record if one is present together with its initial and step values or the phrase empty as shown below. The exact spacing is not critical here, but all items must be generated and output by your function. 0: <the first record> hl is 82 h2 is 4 5.1 a. if T’Ahla “S ., 1: <the second record> hl is 5 h2 is 17 3 ‘ ‘ fi '3‘" 2: empty 3: . . V x: <the last record> h1 is 25 h2 is 77 H ; C++ oMS‘wm ‘. M359. macaw); HAVE, (unsxsnedx 4< ifiand Ranch)“; ~<-—.a M,“ km- W...” Ugfld priniTahlé ( 3 { m1» 1) kmkvds 41¢;ng ' 24 we; “Mi - n. u . Covcl << Z L( .\+ 3 W i +kblgtil‘gmom =: 41M,LQ.\SL vadr L \\ \\ a “k . ‘QNM (<1 Ehdfl J Q0fi+‘nml 5 idsai THESE Two L'NH. N i§l\\_00mfi (< fiblitil. death 3 gingomcubggznffitw H, hex/Maud =' (”Slow-N mWZii-AWWZ AND 43 METMDTDS, COM L< ‘\ W) )5, “ L< bM/Luw I:70 $136.; COVLA"<< \\ m is “ “~‘ “WWW 97° (Sflifi‘ilil << efldlg i’ ...
View Full Document

{[ snackBarMessage ]}