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 Document
Unformatted text preview: CSE 100
W.A. Burkhard Midterm Examination
October 30, 2001 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.
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 regrade. n... Soum‘toms oce or cs100 login 1 7.
2 8.
3. 9
4 10.
5 11.
6 12. total Table Data Type: Hashing name For this table problem, use the hashing functions
initialProbe(x) = x 7. 5 and step(x) = ( x '/. 4 ) + 1 for a table of size ﬁve. nunn
0 1 2 3 4
1. What is a possible insertion order for this table? _
i ’Z J 1 HJ 1 '7) 1 Q '2. one [if mus7» be Roamtea Amiism V7, \ O C QV“ b 2.. ‘i h get at.“ 3+] men 2. What are the average successful and unsuccessful search lengths for the table?
SM mesa«Fm 2 W...» «W... ., , .. .. .,m(... .
‘0 “ O o \ \ \ l
\71 ’2. \ \ l l 1
‘ “3 l l I i
i r) q 2) L’LJ LI L 3 Z
auMOﬁe‘ s‘S‘Q' = é/‘i’ mfgIii. aw“? M59“: 3.9.  (’2.
. mo _ 3. Do your answers to the previous question depend upon the insertion order? Explain your answer. Wes 01‘ [I no be???» S~S.Q\ Q‘ u\$.Q. can Nkav‘x OVAA ‘q “(‘5— ‘Ih'SGA‘i'ﬁd in “FEE. OPQOSE‘M. {Drab w iV\‘ +th (03;.
[6+8 6 .— 5 Q .0 13 M.§.Q 3. was: ’ ’
0‘32: S.$.Q.  /"’( ‘3“5‘8‘“ 20 A) Triangular Arrays name _—______._ An application has an array index set consisting of pairs (i1 ,i2) with
ilin{2,3,4,5,6,7} and igin{7,8,9} and the further requirement that £1 < i2. 4. You are the create a location function mapping the index set to a one dimensional array; the one—dimensional array should use as little space as possible. For example, you might map index (2 ,7) to location 0; but this
is not necessary in your solution. Table Design name We are to store 1500 records in a table structure implemented using separate chaining collision resolution.
We desire the expected successful search length to be 2. 5. How should the table be implemented; how many lists should the structure have? Wperf’fﬂd Smocasglué Sale/‘91“ QC'M‘TL‘ 3 1+ 1+% 3: Z lmpliiS (X 3 Z (X 3; #Vecqul Wu... ~ "in Emu 750 tst \ 6. What is the expected unsuccessful search length within the table speciﬁed above? Mpwle/cl ongvxccexﬁel SWOL gwﬂﬁ,‘ : 9(+€ ﬂ := 2. + 0.155” Table Design revisited name _—___...._.____ In this design, we are to store 1500 records in a table structure implemented using double hashing collision
resolution without passbits. We desire the expected successful search length to be 2. 7. How should the table be implemented; how many buckets should the structure contain. The graph given in
the ﬁgure below may be useful here. Fae/m FIGURE: (X x 0.8 o< ... # YQLOC'CLS .1: A is b molwts WW
Should be, pmwz >/ Mag”
8. What is the expected unsuccessful search length within the table speciﬁed above? (
@4469,qu buns w. cessth Seaman £9» 34")" Z ! ___ d successful search length
double hashing expected values 1.6 2‘
4. 1.2 0.4 0.6
loading factor List Maintenance Algorithms name A list contains two elements, one with access probability p and the other with access probability 1 — p. ‘9. What is the expected number of accesses for the moveto—thefront algorithm? expeutul NAmbex m5 théSS‘GS 2 1+ Zpgap)
: {L + 2p vZPZ no __ __....m ENW—“im WW“ Cler P OS 5 l. 10. What is the expected number of accesses for the static optimal arrangement? Be sure to specify the range of p in which your result holds. Woeded WMmbM. mt accesses 2 19+ 2(1'9) : 2~PM £05" ant) P
16 p 2 UL 11. Priority Queues name What sequence of naivetree priority queues results from inserting records with the following ranks into an
initially empty structure. Show a tree after each insertion; be sure to include the rank at each node, as well as the direction, and distance information at each node where these values have been updated in the current
tree. Heap order has the smallest rank record at the root. 44, 80, 64, 20, 10, 44, 50, 60 (“Cl C Programming name _._————————— 12. Let’s assume our Table data type has a method smallPrint that is to list the contents of the table together
with the bucket number. As on the homework two printTable function, let’s assume the buckets contain only an integer value. Empty slots are designated by the word empty. : <integer value in bucket 0>
: <integer value in bucket 1>
: empty : <integer value in bucket 3) (DMD‘0 x: (integer value if any in last bucket) Write, in C, the smallPriht method with the signature
deﬁne all ﬁelds you use from within the Table structure. “Old " Smbllpﬁn l, l 1;
£0’LC120‘. ‘\
ﬁx t «3 COMﬂ'lt'L] 2B: o‘l‘:
4: e) ‘bchCi'l 9 24 faSgQS a: mt ' tax/1m 8 void smallPrint ( Table t ) . Be sure to 1++ )» "‘9 COUnJcEiB E: o) in haila Fol; ...
View
Full Document
 Winter '08
 staff
 Probability theory, Cauchy distribution, table design

Click to edit the document details