This preview shows pages 1–7. Sign up to view the full content.
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 Document
Unformatted text preview: CSE 100 Midterm Examination
W.A. Burkhard November 4, 2003 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 seven 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 studysheet must be turned in with your examination.
9. Examinations written in pencil will not be considered for regrade.
10. You may use a calculator. Laptops and cellphones are not allowed. SOLMWONS name oce or 05100 login 1 6.
2 7.
3 8.
4. 9
5 10. 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 ﬁnal record is inserted. 012345678910 37, 50, 23, 84, 51, 45, 58
Use the “standard” start and step functions for double hashing and show both values for each key. STAQT’ §T E P 2. What is the expected successful and unsuccessful search lengths for such a table with the loading factor above? o<= V/H (Jamaica unsuccessiul __: H a [.3’7 seam/ox \thth (I — %e(q/") [1813150 * “LL. SS M V__ ‘ ‘ ‘_ w ‘
Wedémﬂwgﬂq  __J7?Lﬂ@8€(q/n)  1.5% § \ 2 NOT
W NEEDED Brent hashing name . Insert the following sequence of key values into the empty table using Brent hashing. Use the “standard” start and step functions for double hashing. Show your work especially the selection of the record(s) to be moved.
0 1 2 3 4 5 6 7 8 9 10
Iall
(lb 37, 50, 23, 84, 51, 45, 58
STAM‘ sTEG
3% <4
6,0 i Same as "m ‘Pfolaléml,
13 i H
CM ’ 5
5 '7 '2
LfS I é
5‘ a; 3 Cl CIRBr Com/(slow; gel g g/ ; iarxcrerrmwylzeoN 5.0521. 1 .3, 3
S l'. H M Z s/ 31:01, q SECOND COLUMDN: 23 X 95’, 231 incremcmwﬁl 0031’ l+ l , cmr Do ANY
A BETTEJQ,
1’3 moves '76 SW?” 5 Binary tree hashing name 4. Suppose we are to insert record K. What does a node and its left and right children designate in binary tree
SSEMODE HAS AN ASsvuA‘TED Taiwan; Q1301
HAS ASSOCIATw Maze!) kc, moﬂgodgja) EACH‘NODE
HAS "'IHQEE PLELDS; a.) \Oc‘dﬁm L) $4149 3239:}; ([19, assoczlm‘JiCd (award—3 ~11};
bian W '2’. WIRO‘)‘ N005 r
4.35am UoJ/Mh, (Kai) w/Ww Q l3 THé " 5
P439735 0/; K (2,35 lg ['73 57505125, a AgsoclArw R510!»
( 52) S, “L > #9
$122) (5&5) E) Zi+1) THEAésmATw macaw 15 N {207 (2+5 This problem is concerned with the diﬁerence between Brent hashing and binary tree hashing. The following / tree is logically built during an insertion using binary tree hashing. Brent hashing builds no such tree but
visits many of the some slots within the table during the same insertion. The same table conﬁguration exists for both Brent and binary tree hashing for this insertion. 5. Which nodes designate rearrangement exploration beyond that of Brent hashing? For each node, mark “yes”
if the node designates an exploration that Brent would consider as well and “no” otherwise. yes [34 AM yes [24
“.0 El no E]
2/ yes ﬂ
yes or no 3 not: 3/ o yes _. 01" yes 01' yes 01‘
no __ no[:l noEI Hashing performance name 6. What are the average successful and unsuccessful search lengths for the following table? 0123456 The records were inserted in the order 39, 82, 20, and 26. Show your work. STEP 1 Z 3 A} 5’ 6 AVERACrE
START UNSVILQSSSFIA L
I I I I I I I : iii—3;— 3/]
2 I I I I I I L”
l AVWD'E
3 I l l l l SVLCLESCFVIL
L/ l l ' l l l SMQLH z
5‘ 2’ 1 1 Z Z L I+I+l+ Z _ ’5,
e l I I I I l LI ' /L71 7. The probability a search L takes 2' steps is ai_1( 1 — a) for i Z 1. What is the expected number of steps; ‘, ‘vI (PA EELI] :: (IwIJZZoU : Fox)”: 1‘0‘ 12 this question has nothing to do with the previous question. HT LIEASI‘ Two NAYJ To (O‘N'T—INMEi
m WQITJE ow’r s'M/VIM/IT'IOAJ I ” so”. L >1
X 3 ‘I/ [Tax+ ’ IJA
Ix”é a”
(X3 {X3 0‘3 IX} , 0 C.
EAcI—I TEQM Is “THE 9AM
‘ A (Lou/INN. 5— ~ Z, .21...—
b3 DI’FFeagwﬂ/mr M777 gamer/'7’ ‘1? 9< BIO Id Triangular arrays name 8. What is the fewest number of slots needed to implement the three—dimensional array with parameters 0 S 2'0 < i1 < i2 < 10 ? Indicate how you determine your result. E/XACTW (130)“),0 guy:3 Am; NEEDED, a) Fimr uNmi—A) sto'T f? (Oil/‘0) O R .f bl LAST 0550 51,07 +1
‘ l
i+(?>+(§3+(;) go) 9. Write a C function that implements the location function for the array in the question above. You may assume the parameters always satisfy 0 S 2'0 < i1 < 2'2 < 10; you may use if necessary the function
int choose( int n , int k ) which computes and returns int location ( int 10 , int 11 , int 12 ) { in"! Ice; lac : Ckoosefzo, l) + choose( 2,1,2) «— LLocso—( 17/2,?) (oh/Wk lac; Move to the front heuristic name 10. The search length for a list in the optimal arrangement has expected value 1.79. What is the largest possible expected value for the move to the front version of the list? “N, ..
EMTp é é, E09? 1 EMT; e 352; 4 A: 258 OPTIONAL: What is the largest possible expected value for an optimally arranged list containing n items? Maxn +0 (664% are"me OM 1124’ Wm H 1»le WBKn 7 Ln+\)/7.. 2 1: Us) maxf‘ a; “*1 mexnae .: “ti—“ne— ,.__—— s... 2. 7/ Once M WUEM we. gal'6; Sew +0 calf 01M. TWA/U: Fm, m2) (l/l+e)+2(l*'/L"é) : 3/2‘6 = 3.6"“ . . ' l V .L/ R“ 1 RH
, w 1 ,_ . — ,. ~ »‘.___ _ _...
Wk: : + “7 El’ 6) '— + 1 + 2. 1 7. e
_ _ > V / I
—; k+L__ Erie : R+1_ m“ e
2. l L ...
View
Full
Document
 Winter '08
 staff

Click to edit the document details