{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

6QA3698Cd01

# 6QA3698Cd01 - CSE 100 Midterm Examination W.A Burkhard 1...

This preview shows pages 1–6. Sign up to view the full content.

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

View Full Document

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

View Full Document

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

View Full Document
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 24, 1995 1. This is a closed book examination; one 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! . , ’ 3OLM‘T (OMS name oce or c3100 login 1 7. 2 8. 3 9 4 10. 5 11. 6. _____—_ total Table Data Type: Hashing For this exercise, use the following hashing function h1(x) = X Z 11 for a table of size eleven. 1. What is the (entire) probe sequence for key 24 ; name and h2(x)=1+x'/.10 hiZZ “1:5. 217311é’)0) 5/ 'OJLf) 92338 2. Insert the following sequence of key values into an empty table using Ordered Hashing 24, 33, 47, 32, 31, 27, 54, 72 Show your work here k :L m. mate, 33 o o 9”? 3 3 32 (O 3 no, 2 3! CI 2. q 17 5‘ 5” 5% '0 ”"9331 l O ‘71 6 6 3. What probes are made during an unsuccessful search for key 65 ? ii 1(65) 7. \0 lo 1; +32, em; 93‘: «the. sumk 9th 57% 4265’ __ _ _ Table Data Type: Hashing name 4. What is the expected successful search length for our table with load factor 18—1? l » I! 2%— IOSQ(? 5. What is the average successful search length for the table you created in problem 2? '0/8 1.25 H Triangular Arrays: Saving Space name The four dimensional triangular array routes has index set OSi1<i2<i3<i4<25 6. What index has the largest possible component values? (2 l, 2,2, 23, 2w) 7. What is the size of the smallest possible one—dimensional array that Will contain the routes array? pom-Hon 04F hays?” i+€m Och/”Vi: ‘4”er “MME‘ZW bangers... i‘t“ r 2,5” __ postwwo¢22§p m (4,)— OK l+<,'+){7'1) (13) [703w- arm, 8. Where is the index (5,7 , 10, 14) located in the array of problem 7? <v>+ > + 52w (:5) I3~ 1.1 , on ‘W 21. s at -4- Run—Time Performance name 9. What is the G run-time for this code fragment? for(inti=1;i<=n;i++) for(intj=1;j<=n;j+=i) X[i1[j1=35; ht: h MIN/ﬁr”? +7?) i:2: n/z +IM¢S i=2 .h/B +mh h (0 Qty“) 10. What is our run—time performance result for the “move—to—the-front” heuristic? ya ‘ Lé‘é m be Mfume“ [m [Mﬂ+1a, S W QQaﬁftm éwhtfn 0'; “to?" \$571) an A “ﬁrm/3% 0'; S :: m ’ TNT? (lg) "J 4’th +0+Q/\ ‘4an Be, r a ‘F‘ COMPM-Lgvﬁj Medal ”W; V915? Omci .‘i‘”;: S 4 55% M ““65“ +9 ”m —- gym“? lﬂﬁhh’ﬂi’ﬁg TOGTCSB 55 W H‘i’M WMw-wbaq The, nonrcuvxrswe VeAslorx ’PleCé‘: 4"le +O‘bgvrclmrned‘ erlvua in O; logal uarimble teme, W C++ Programming name 11. Write a non—recursive version of the following function; you should use the familiar Stack class. . d ( . d . , . d . ) :nmgne aaa un31gne 1 un51gne J C. (as; REC. E if(i==0) public: ' .f (return03)+ 1 ; unggned ’LJ )S'la—rzs l 3 == return aaa(i—1,1) ; Rec—09A ( 3i 3‘ else . I return aaa(i—1,aaa(i,j-1)) ; Rel-”(A LUR\$x3ned K ) } r VmStCaJnié, {<3 I Vm" " Here is the Stack class. _ . M6“ {Q S template <class DATA) )0 (%)J +8 \" class Stack { f I List<DATA> * stack ; o , public: } ) // Vetox’a dé—l‘ ‘ Stack ( void ) { stack = new List<DATA> ; } “ Stack ( void ) { DATA data ; while ( stack—>pop(data) ) ; } Boolean push ( const DATA & data ),; // etc ..... Boolean pop ( DATA & data ) ; Boolean top ( DATA & data ) const ; } ; . \AY\\$]ahe& ‘) n , «'3. 012' mace ( Unsigned. i) MnSicanclj i l .«e - v ~> \ / Rec. will Yeti-1) girl"; ‘. Stack< Rex—7 Slack; “not; ? sln (.Ve’ 7') ' . m - 9 sea a . Rec N-CCiJJJCb33 ' ' 5° MAW” Staph. PMSHC me 33 A 2“ at“ “‘3’ “‘34) f" abet”? \Avxmcjnacl +0“? ___ O.) ‘ SgﬁbkaMLx rec3 )3 wide. (skwhpoelcOr—l \ i ? F moi/Yelena cl (1”. as. SW‘I‘lC/qu fecvsvl'ariv Ii V‘W 7— :431 C): { CGSﬂ 1 I i it < 1:“ till. . Rec Mme?) :2 MP ‘2‘. I J , A “Wk-MUM )3 '1, break; ll: ( (“"3 :: O)i I? }} ”ehAu-ycwkii R94 V€1<T%‘i‘lJﬂ-J¢>ll {‘t‘l’hrn +3Mp‘ S+0~Lk.?v\\$lﬁ( Yul); J n I/ de (/7; 4 break; F , } aaa ? else. \ ...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern