This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CSE 100 Midterm Examination
W.A. Burkhard October 28, 1999 __________________________.____—————————————— 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 eight 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! ' ,
8.: Turn in your study sheet with your examination. 9. Examnations completed in pencil will not be considered for regrade. me .gOLMTlONg oce or c3100 login 2 _______'___._——
a 3. _______.._——— 9 ________.__._..—
1 ' ‘
4 ____________ 10 _,_._______‘
5 ____,_____.._—.— 11 _______.______
5 ._.___._——————— 12 ______________ total ———————+—— Table Data Type: Hashing name
For this table problem, use the hashing functions h1(x)=x'/.11 and h2(x)=(x'/.10)+1_ for a table of size eleven. 1. Insert the following sequence of key values into an empty table using Brent hashing with passbits. Your
solution must show the passbit values for each location in the table after the ﬁnal record is inserted. 47, 55, 60, 72, 73, 19, 91, 85 passbit Show your work here including the incremental costs for each record collided with during an insertion. LFT‘ hgl‘ El __ ”7 move. "l q “(’0 slot 2. Costs 1 +9} 3 5
.. e ‘ LIN/move 60 +5 slot 9 certs 144} : (a
‘3 S; O 6 MIV‘K '73 +1) 5 loJC' ' L} C0953 3 +1 1 5’
(7 O: 5 1 MW 9[ in Slot Q Ciri:_L:f——__:Lf
rl 2—: 6 3 ./> NOV 6 '9 +0 5 lot L/ cogf3 lrL/ ;' 5
‘ '7 L14 if Move, Li”) H: 5 lot L Cow—J 2/44.} ; 6
Wg" Y E ! MDVQ 9‘ +0 Sui: Z Costs 3_+'2_ = 5
'lhw ZS in s\ot Li (Loyh L'I : 51 2. What beneﬁt(s) does(do) passbits provide? 'Pkssews Rem/me THE UMsvchssFML SEARCH kENCxTH. hm Table Data Type: Hashing
For this table problem, use the hashing functions
h1(x) = x 7. 11 and for a table of size eleven. name h2(x)=(x'/.10)+1 1. Insert the following sequence of key values into an empty table using Brent hashing with passbits. Your
solution must show the passbit values for each location in the table after the ﬁnal record is inserted. 47, 55, 60, 61, 73, 19, 91, 86 01‘234567 Show your work here including the incremental costs for each record collided with during an insertion. l’xl la’Z. 3 \(YxoUC '1’? +0 51% 2.
L4‘7: 3 8 WV; (90 +13 “at 9
55; O 6 _ move. '73 +0 519+ L11
60: S i {metre CH islet—:9.—
6\2 6 ll ”mm q; +0 slot 7.
W33 r7 i j" I‘move 60 +0 gigt l0 (:0;
“ ' 310+ 1 01° 3 l e 1 2. L].
12810 I"
,9 l./
6%qu 2. What beneﬁt(s) does(do) passbits provide? passbit Cos‘i‘i 1 + “i 1 7
(303+; 2 +4 3 T
Corr: 3 + Z :_ '1' / éos‘ri H : Table Data Type: Hashing name 3. What is the average successful search length and unsuccessful search length for the following double hashing
table with passbits'? The key space is the set of positive integers. The hash functions are h1(x)=x'/.7 and h2(X)=(x'/.6)+1 passbit
4 5 6
13¢on seghanceg l5: l ‘ :38: 3 [3; 6J 1 J 3) 5  80; 3) e AVEEAQ—E: SweeéSjpt/u. SEAQLw Legerm : w z 2
ti. AVE/tetra Uusuccesseuc SEARux LENG‘T‘" = £3~ _3__‘;/
Ll}. Ll Table Data Type: Hashing name 3. What is the average successful search length and unsuccessful search length for the following double hashing
table with passbits? The key space is the set of positive integers. The hash functions are h1(x)=x'/.7 and h2(x)=(x'/.6)+1 passbit l5 3 3s; 3 \9; f goo 3J6 AVE/Meg SMCLESSFML. SEARCH LENGTH: l+l+l+L : 5/411
a H AVERAGE \AUSHCCESSFML SEARCH LENGTH = qg g/ ’2: l7 Table Data IVpe: Hashing  name 4. Two table implementatious both utilizing Brent hashing are claimed to be correct while the results obtained
for average‘successful search lengths in tables Created for the same set of keys inserted in the same order differ slightly. Is this possible? Explain your answer. ' .[Zryes or D no Bmsm‘ Manama: Does NOT \AHEV mom. WAA} p: swe
omedAg. RES (3ng T IE: TH AT‘ CA G Ll; INSTANCE, 0::
N Imus .
THE SMALLEST meaﬁmgmnr cos? r 5. Two table implementations both utilizing ordered hashing are claimed to be correct while the results obtained for average successful search lengths in tables created for the same set of keys inserted in the same order differ slightly. Is this possible? Explain your answer. D yes or Brno REC/01m) PLALEMENT‘ Foe. oma‘ﬁab HAMawe ‘5 name Priority Queues 6. The following array occurs during the execution 0f the Floyd— Williams heap algorithm. What tree does this array represent? 7; Show the array after inserting the record '1‘. 8. A Floyd Williams heap contains 17. items; what is the runtime of the insert method? * @(Qwécm) ’.\ C Programming name 9. Let’s assume our Table implementation does not include the sProbes member but is otherwise as it is within
homework two. Write, a generic successful method for our double hashing table implementation with passbits in C; this
function is to calculate the average successful search length for an instance of the table. Assume the function. has exactly one argument — a pointer to the table. An empty table has average successful search length ,
equal to one. Here is our Table structure — ' typedef struct Table { int sizeTable ; /* number of slots in table */
int sizeData ; /* size of‘ data per slot */
int width ; r /* real slot size */
int count ; /* number of items in table */
int (*value) () ; /* data to integer vaue V ' */
boolean (*equal) () ; /* equality test between two items */
boolean (*copy) () ; /* copies data; right parm to left */
boolean (*print) () ; /* displays a single data item */
double * slot ; /* the array of data slots */
boolean * ,isempty ; /* false if slot occupied; else true */
boolean * passbit ; /* pass bit semantics */
} a: Table ; The signature of ”the to—be—created function. double successful ( Table t ) ; Begin by stating the logic or strategy for the code you are about to write. WALK TriROUKC—m ”THE "ramp EXAMUQUJC" EACH SL'L’T' FOR EggH {Shiva ‘3=;’~3£,E£\,IT‘ DETERMINE, 1T3 .Poglﬂod
on 1T5 DQoBE. SEQMENCa' SM/Vi THESE POSITlO/‘JS AUD
a DNtoE/ BK fable cows—r. RETL/lmrd THU vALMtE r“ 7}
175 “THE AVERAGE Smccgssr‘ML smﬂcw uEMGXh—‘l' Cope 0:0 ’meAJeXT ’PPrGrE... C Programming name dom‘bK’. SméLESSgw‘ ( T6~\Q\C 11' ) inf '5.) 3+6?) inch/X ) %+a\ 3 0) qu 3
am: 3 t» W s m >
H: ( t...) '[email protected]+k3{13 :2 :: “Lake \3 ‘i
Dad = (taualmd'tVslot + isn‘t—7 1,034+“ 3 .
2 Wm!“ = Uc\\ °7¢' (t4) g\39,Td~b\e.§ j ,
5+{P = stl 020 (t *> Sip—Tabk ~1§ + .13 +o+e\ ++ a J
wkﬂgﬁ index 1: i ){
”tie/ac : (MAW 4, 3+9?) ”7° (+ —> Sky—Tame); ”r 1+ °
.oiia +3 3 rum/Mn (fNcovms > o) '3 (ciuukk‘) +u+a\/(~E —> ovum): 1.0 J name ____________———————— Miscellaneous The index set for a twodimensional triangular structure consists of pairs of the form (i1, i2) where 05i1<i2<10. 10. What is the size Of the index set? K2. 2. _...— I
q 11. Where is index (1, 7) located in the onedimensional array implemention of the above structure? {2)+U) : ale! ; 2.2“ 12. What is our performance result for the movetothefront list maintainence heuristic? Deﬁne your terminol ogy. a EMTF E 2— EOPT' _ j
} . NRERE 5.0 .NU‘MGEQ. 6F ‘wmpAmsoAu .s. we expem’
‘ urn—UN ’D—lz': MOVE" 9611 Access OPERA‘VV’N'
TomEJPQoNT ALGoeuTH/V‘r EMT? ‘0 p slammed—row“
*n—lm “THE EopT ls 7H6 meet/Tao rummage pit/l AccéSS (”>prth W! OpTln'hGL ST'ATIL ...
View
Full Document
 Winter '08
 staff

Click to edit the document details