FinalWithSolSu99 - EEL 4851 Final Summer 1999 Tuesdays and...

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 DocumentRight 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 DocumentRight 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 DocumentRight 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: EEL 4851 Final Summer 1999 Tuesdays and Thursdays 8:00 AM NAME tew IVOV) SS# Note: For all questions, an explanation of your answer allows me to give partial credit if the answer is wrong. 7 1. Short questions. For each question you must explain your answer. Write neatly. I can not give you credit if I can not read your answer. a. What is the best sorting algorithm for sorting a list where the items are in a file and it takes a long 27X fflck time to swap the items. §€(€CJ[{OV\ gor’i €00 éwafg QKMAD éflmymffé b. What is the advantage of using a heap instead of a binary search tree to implements a priority queue. baby we QCfiiyl/I) IQMJr 1mm“ flee l/mé 6t [MW 6V (vn§+am+ git/MC f \flag move 0V CY, 4190 a. heaf/ 9mm: {{rrs w Campidrc “55/ Ca“ be 65mm) in a. QIWf/de/ayn c. When balancing an AVL tree why do we sometimes need a single rotation and other times a double. iQ the Vool’riolpe 1‘5 jwé‘l‘ be law He met 4 Wk VmLal'x‘ow W! 9a. [4 ft 1'5 0? [eve/9 below ’Hiew V6 M665 a glv/mlci‘roiufi'ow gm emu {Wet :> acme Wat-W h. If I use a hash table with 1,000 buckets to store social security numbers (9 digit number) will the sum of all of the digits make a good hash function? I l0 wan/2w *4 999% r) Van/oz 70 V‘myé (“7 foo 9mm”. Jafiflyam We 450;: 1217967: llqa< 1000 19er smallest {s "622%: ail/62% wed/:er I Van/06 (#ZRwlllLB) 9M! (Poor i. What is the advantage of using double hashing over quadratic probing? elmzmm we 96mm (MW Kroblzm. j. What is the best sorting algorithm if the list is almost sorted. i‘456vhotn Qari. pwir dLOQ. “471+ We a Wait ime a; 00)). k. What did the Shell sort algorithm do to achieve an average running time of less than 001 2 ) ? équ? {hex/146 de MOi' ivyeflaev. 1. What did the Quick sort and Merge sort algorithms do to achieve a running time of 0(n log n) ? gterbC am} €0hfh€V QX(S00)Q+)000 < I000 7‘ QOV W‘eV/am/o 0V VON/it'immw m. Will there ever be a sorting algorithm that performs better than 0(n log n) ? Why ? _ We :H’ Wat, gnu/em ’Haai‘ )/sz £1663 patio/0w) Camfaw‘éoné. 60 749% [0M- l/Wi~ d9 bgflzv. Q i, 4/90 (7646?: 61W ’HAc ivb/z inag 0n)?! 3 Vial/hf? 34 E“ 1* Theorem Them 2. Hashing. a. Suppose hash("Tom") = 0 and 1 s / SK 6461/} Explain you answers. If so where and if not explain why. b. Derive a good hash function to a/ 1'9 0Q 926 7 m3 7 13 (gm/“6 6M3 hem vrmgf gm} ma ewwty bM/T‘fh you are using quadratic probing, can "Tom" be inserted into the table? fi—a Lian): (ball/100 + 1'28 W05 7 WWW"; {93 0 how-3 0 I use with a table size of 1,000 bucket used to store social security numbers. Show the fimction or equation. Tkevz ave WWM/ 0M2 fmdolg W/ [‘9 {'0 ’i’aA’6 Hz. [629+ 3 fiyfis a? 5‘ CJM/dé 7)”)91’7L Wuwbélfi Vavyé ;’ 5,. not be found even if one exits. use a function that uses quadrat Quadratic probing has the problem that when the table gets more than half full an empty bucket ma 477 I Y Since linear probing will always find an empty bucket if one exits, can I ic probing when the table is less than half full and linear probing when the table is more than half full? Explain why. 4/0, He bfiékl chimw l/Vlw9i‘rKY‘OViBQ M WMZYWu/y 90 H” Gina/1’3 al/W/9/W6 The 9mm ““ 29le This 0‘“. +05 i’ab/é 9126. 04+ ML gov a New QM mg: i tom [8 ééf‘jqw 3.9m 1’ I W W G) gx/ e) E”? 99 yea @ 3. AVL binary search trees. Given the following AVL tree show the tree after inserting 8. o gomfi MW 4+ 7% "l0", (/OQH 4+ M€X+ 3 anlLt'Qfg 0 ‘9 f) / a {3/3/ 7. 7% 7 :9 flag @ 0 View “My-\- aw} {+9 9\ [gvelQ bow” (70 wz Maeé 3 “ aawbzf V0+af.‘oh. 09 V . @ @ @5 “a J @ Sq). / @/ ‘ ® ifW‘a (L) \/ 4. Heaps. Refer to the following heap that this Jahle’ represents. Recall that the C++ language has the left \ ' most component as index 0 not 1. H I l 0 I 23%557g410urf/2f) 5 l a. What number is the parent of the 8? . . ..——~_\ ,— II I/ [k b. What number rs the left chrld ofthe 8? / % /> I 0 ‘ c. What number is the right child of the 8? N _,,_ l ( 1/ 6/ ’2 " )5 5 X d. To the right draw the heap that this table represents. ‘ 5. Shortest path. Find the shortest path from vertex 5 to each vertex using Dijkstra's algorithm. 1 S Dijkstra‘s algorithm is the one we covered in class for finding the shortest path for weighted graphs. K J "Q" 15 @ b. What is the sequence of vertices that the Dijkstra's algorithm will process. v5, \/7/ V4 VR,VI/\/L+/\/’s/V8 (5, Z 6. Graph representation. a. Draw the graph that this data structure represents. 0\ [01/ ...
View Full Document

This document was uploaded on 01/14/2012.

Page1 / 6

FinalWithSolSu99 - EEL 4851 Final Summer 1999 Tuesdays and...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online