CS4115 Database. 20. What is the time-complexity of squaring a matrix of size n n in Big-Oh notation?

Size: px
Start display at page:

Download "CS4115 Database. 20. What is the time-complexity of squaring a matrix of size n n in Big-Oh notation?"

Transcription

1 Sectio 1. Autum 00 Mid-Term 1. I a multiple choice exam, if egative markig is beig used, what should be the pealty for wrog aswers so that somebody who guesses throughout eds up with 0; each questio has four possible aswers ad the questios are worth four marks each?. Which of the aswers below is i=0 i?. Which of the aswers below is i= i?. Which of the aswers below is i= i? 1 1) 1 1) 1 1) 5. Which of the aswers below is 5 i=1 i? Which of the aswers below is i=1 i 1)? Which of the aswers below best approximates Oi 5 ) O ) O ) O 5 ) CS115 Database 1 8. Which of the followig is the correct orderig of the fuctios,, 1000,? 1000 < < < < < 1000 < < < < < 9. Which of the followig is the correct orderig of the fuctios log,!, log log, log? log < log < log log <! log < log log < log <! log log < log < log <! log <! < log log < log 10. If T ) = Of)) the which of the followig is the most precise statemet? T ) = of)) f) = ΩT )) T ) = k f) for some costat k f) = ΘT )) 11. If T ) = Θf)) the which of the followig is the most precise statemet? T ) = Of)) ad T ) = Ωf)) T ) = Of)) but ot T ) = Ωf)) T ) = of)) ad T ) = Ωf)) T ) = of)) but ot T ) = Θf)) 1. If m = Θ) the bucket sort has timecomplexity most precisely) O ) Ω) Ω ) 1. A -time algorithm sortig itegers i the rage [0, 1] is possible by makig passes of radix sort, with buckets of size / / 8 1. The time-complexity of expoetiatio to the power of is most precisely) Olog ) o) Θ) 15. What is the time-complexity of computig i=0 aixi if a dumb expoetiatio algorithm is used? Olog ) O log ) O ) 1 The time-complexity of searchig for a item amogst a array of sorted items is most precisely) Θ log ) olog ) Olog ) Ωlog ) 17. What is the time-complexity of the followig sum = sum + ; O ) Olog ) O log ) 18. What is the time-complexity of the followig for it j = 1; j < ; j = j*) sum = sum + ; O ) Olog ) O log ) 19. What is the time-complexity of the followig for it j = 0; j < ; j++) sum = sum + ; O ) Olog ) O log ) 0. What is the time-complexity of squarig a matrix of size i Big-Oh otatio? O ) O ) O log ) 1. For the AVL Tree show i Figure 1, what type of rotatio would be required i order to isert the value 1? A left rotatio A right rotatio A right-left rotatio A left-right rotatio. For the Biary Search Tree show i Figure 1, what is the iteral path legth of the tree? For the Splay Tree show i Figure 1, how may splay operatios would be required followig a fid5) operatio? 0 1. For the Biary Tree show i Figure 1, which of the followig represets a post-order traversal? 11,1,9,8,10,5,,,,7 7,,10,,5,8,1,,9,11 7,,,,5,10,8,9,1, For the Biary Search Tree show i Figure 1, deletio of ode 7 would result i which of the followig odes becomig the root ode? Sectio. 10 or 10 5 or 8 Autum 00 Fial 1. O the first day of Christmas, O the secod day of Christmas, Two Zetor tractors, ad O the third day of Christmas... How may lies would be i such a poem if it ra for 5 days istead of the usual 1? Which of the aswers below is i= i? 1 1) 1 1) 1 1). Which of the aswers below best approximates Oi 5 ) O ) O ) O 5 ). A -time algorithm sortig itegers i the rage [0, 1] is possible by makig passes of radix sort, with buckets of size / / 8 5. The time-complexity of expoetiatio to the power of is most precisely) Olog ) o) Θ) What is the desired upper limit o the load factor, λ, for ope hashig? λ.0 λ 1.0 λ 0.5 λ How may bits are required per ode to store the height of a ode i a -ode AVL tree? log log log log 8. How may odes are o the bottom layer, h, of a complete biary tree? at least h at most h exactly h oe of the above 9. A iversio i a list of umbers is a occurrece of a pair of umbers ot i order. What is the expected umber of iversios i a list of umbers? ) ) +1) +1) 10. Suppose we exchage elemets A[i] ad A[i+k] of a array, which were origially out of order. How may iversios does this remove from the array, at most? 1 k 1 k Which of the followig sortig algorithms is the odd oe out? Isertio sort Selectio sort Bubble sort Mergesort 1. Although Mergesort has a better worst-case ruig time guaratee tha Quicksort, it is ot the sortig algorithm of choice. This is because It ca be outperformed for small values by, say, isertio sort It has high overheads costs) associated with it It eeds to have all of its iput i primary memory Its performace degrades sigificatly whe sortig o-itegers 1. Embedded i Shellsort is what sortig algorithm? Isertio sort Bucket sort Heapsort Bubblesort 1. For Shellsort, a bad sequece of icremets, hk, is oe where Each of the icremets is a multiple of the previous Each of the icremets is a prime umber The icremets pairwise have o commo factors No set of positios of the array will be i the same subarray too ofte 15. Fidig the media th elemet) of a elemet set ca be doe i average time O log ) O ) 1 A adjacecy array would be a appropriate represetatio of a -vertex graph if the umber of edges was Ω ) o) 17. The ruig time of Depth o a graph, G, is O V E ) Omi V, E )) O V + E ) Omax V, E )) 18. A graph, G, ca be tested for acyclicity i time O V E ) Omi V, E )) O V + E ) Omax V, E )) 19. Every vertex has eve degree is a coditio for a Euleria Circuit. What goes i the blak? ecessary sufficiet both ecessary ad sufficiet either ecessary or sufficiet 0. The Depth -based algorithm for bicoectivity is a example of both ad processig of odes. The blaks are Sectio. iorder, preorder iorder, postorder preorder, postorder iorder, postalorder Autum 01 Mid-Term 1. I a multiple choice exam, if egative markig is beig used, what should be the pealty for wrog aswers so that somebody who guesses throughout eds up with 0; each questio has four possible aswers ad the questios are worth 5 marks each? Which of the aswers below is i=0 5 i? 5 5. Which of the aswers below is i= 5 i? Which of the aswers below is +1 i= 5i? 1 5 1) 1 5 1) 5 5 1) 5. Which of the aswers below is log b x? log b log x log x log b log x Which of the aswers below is i=1 i 1)?

2 7. Which of the aswers below best approximates Oi 5 ) O ) O ) O 5 ) 8. Which of the followig best approximates 1 i= i? 1 log e log e 9. Which of the followig is a correct represetatio of a b ) c? a b+c a cb 10. Usig m buckets, bucket sort has timecomplexity Om ) Om + ) Om ) O m ) 11. Ruig-time Om + ) is equivalet to A) Om) + or, B) Omaxm, )). Which of these possiblities are correct? 1. What is the ruig-time i Big-Oh otatio of the followig chuk of code?: i = -i; O ) O log ) 1. What is the ruig-time i Big-Oh otatio of the followig chuk of code?: for it i = 0; i < *; i++) sum = sum+i; O ) O log ) 5 1. Let T1) = Of)) ad T) = Of)). Give statemets A) T1) T) = ; ad B) T1) + T) = Of)), which of them are true? 15. I a recet court case, a judge cited a city for cotempt ad ordered a fie of for the first day. Each subsequet day, util the city followed the judge s order, the fie was squared that is, the fie progressed,, 1, 5, 5,5,...). What would be the fie o day? Sectio. Autum 01 Fial 1. The umber of odes i a perfect biary tree h 1 h 1 h+1 1. Give the two statemets below, which of them S1: a log c = log c a, for a, c ad iteger; S: logi log i, for i ad iteger. S1 is true, but S is false S1 is false, but S is true. Give the two statemets below, which of them S1: p) = Θq)) q) = Op)); S: f) = Og)) g) = of)). S1 is true, but S is false S1 is false, but S is true. Give the two statemets below, which of them S1: Heapsort s worst-case ruig time is worse tha Quicksort s worst case ruig time; S: Heapsort s average-case ruig time is poorer tha Quicksort s average-case ruig time. S1 is true, but S is false S1 is false, but S is true 5. Fidig the media of a array of elemets has ruig time best described by which of the followig? O log ) Olog ) Ω log ) Whe performig exteral sortig, the data structure used to efficietly do the k-way merge is a liked list a array a biary tree a heap 7. Whe performig exteral sortig, the umber of passes required to sort umbers m at a time usig k tapes is log k m log k m k log m log mk 8. I order to recostruct accurately a biary tree from its ordered traversals all three traversals are ecessary ay two are sufficiet the pre- ad post-order traversals are ecessary some other combiatio might do the job 9. Give the two statemets below, which of them S1: I a closed hash table, a key isertio followed by a deletio of that key returs the hash table exactly to its state prior to the isertio; S: I a closed hash table, a isertio of a o-existig key ca be performed faster tha a deletio of a existig key. S1 is true, but S is false S1 is false, but S is true 10. Give the two statemets below, which of them S1: The step of Heapsort that accouts for its asymptotic ruig time is the buildheap) step; S: O pre-sorted iput, Heapsort s ruig time is. Sectio 5. S1 is true, but S is false S1 is false, but S is true Autum 0 Mid-Term I 1. I a multiple choice exam, if egative markig is beig used, what should be the pealty for wrog aswers so that somebody who guesses throughout eds up with 0; each questio has four possible aswers ad the questios are worth 5 marks each? Which of the aswers below is i=0 i?. Which of the aswers below is i= i? 1 1. Which of the aswers below is +1 i= i? 5 1) 1 5 1) 1 5 1) 5. Which of the aswers below is log b x? log b log x log x log b log x Which of the aswers below is i=1 i 1)? Which of the aswers below best approximates Oi 5 ) O ) Oi ) 8. Which of the followig best approximates i=1 1 i? 1 log e log e 9. Which of the followig is a correct represetatio of a b ) c? a b+c a cb 10. Ruig-time Om + ) is equivalet to A Om) + B Omaxm, )) Which of these possiblities are correct? 11. What is the ruig-time i Big-Oh otatio of the followig chuk of code? i = -i; O ) O log ) 1. What is the ruig-time i Big-Oh otatio of the followig chuk of code? for it i = 0; i < *; i++) sum += sum+i; O ) O log ) 1. Let T1) = Of)) ad T) = Of)). Give statemets A T1) T) = ; B T1) + T) = Of)) which of them 1. I a recet court case, a judge cited a city for cotempt ad ordered a fie of for the first day. Each subsequet day, util the city followed the judge s order, the fie was squared that is, the fie progressed,, 1, 5, 5,5,...). What would be the fie o day? 15. The time-complexity of expoetiatio to the power of is most precisely) Olog ) o) Θ) 1 The time-complexity of searchig for a item amogst a array of sorted items is most precisely) Θ log ) olog ) Olog ) Ωlog ) 17. What is the time-complexity of the followig sum += sum+; O ) Olog ) O log ) 18. What is the time-complexity of the followig for j = 1; j < ; j = j*) sum += ; O ) Olog ) O log ) 19. What is the time-complexity of the followig for j = 0; j < ; j++) sum += ; O ) Olog ) O log ) 0. What is the time-complexity of squarig a matrix of size i Big-Oh otatio? O ) O ) Sectio O log ) Autum 0 Mid-Term II 1. How may bits are required per ode to store the height of a ode i a -ode AVL tree? Olog ) Olog log ) Olog ). Isert the umbers, 7, 1,, 8, 9,, 5 i that order) ito a iitially empty tree; which of the followig represets a preorder traversal of the of the tree?, 1,, 7,, 5, 8, 9, 7, 1,, 8, 9,, 5, 1, 7,,, 8, 5, 9, 1,, 5,, 7, 8, 9. Which of the aswers below is i=0 i? Which of the followig fuctios of grows fastest? f1) = log k, for ay costat k f) = log f) = 1+ɛ/ log, for ay ɛ > 0 f1) f) f) Based o k ad ɛ, it is ot possible to decide 5. What is the ruig-time i Big-Oh otatio of the followig chuk of code? for it j = 0; j < i*i; j++) for it k = 0; k < j; k++) sum++; O ) O ) Oi ) O 5 ) 7 8

3 What is the depth of the tree i Figure? 5 7. For the AVL tree show i Figure, i order to rebalace it, the followig rotatios) will have to be doe: A sigle rotatio about ode 7 A sigle rotatio about ode 10 A double rotatio about ode Let S1 = i=1 i ad S = i=1 i). Which oe of the followig statemets is true? Sectio 7. S1 = S for 1 0 oly S1 = S for 1 0 oly S1 = S for oly S1 = S for all Autum 0 Fial 1. The umber of odes i a complete biary tree exactly h 1 exactly h 1 exactly h+1 1. How may odes are o the bottom layer, h, of a perfect biary tree? at least h at most h exactly h oe of the above. Let S1 = i=1 i ad S = i=1 i). Which oe of the followig statemets is true?. O the first day of Christmas, O the secod day of Christmas, Two Zetor tractors, ad O the third day of Christmas... How may lies would be i such a poem if it ra for 5 days istead of the usual 1? What is the time-complexity of the followig for j = 1; j < ; j = j*) sum = sum + ; O ) Olog ) O log ) The worst-case performaces of the heap operatios deletemi) ad isert) are both Olog ). Give the two statemets below, which of them S1 The experimetally foud average case performace of deletemi) is S The experimetally foud average case performace of isert) is S1 is true, but S is false S1 is false, but S is true 7. FIX THIS!!! Give the two statemets below, which of them S1 I a strogly coected graph, every ode coects to every other ode by a edge S If a graph is strogly coected the it caot have a cut vertex articulatio poit) 8. Give the two statemets below, which of them S1 If a -vertex digraph has articulatio poits the the graph must have a cycle S If the Depth-First Tree of a graph G has o back edges the G has o cycles S1 is true, but S is false S1 is false, but S is true 9. Give the two statemets below, which of them S1 Startig from vertex v0 i a graph, the time required by Depth- to fid a path if oe exists) to some vertex v is less tha that required by Breadth- S The space required by Depth- is less tha that required by Breadth- Sectio 8. S1 is true, but S is false S1 is false, but S is true Autum 0 Mid-Term I 1. Which of the followig is a correct represetatio of a b ) c? a b+c a cb. Which of the aswers below is i=0 i?. Which of the aswers below is i= i?. Which of the aswers below is i= i? 1 1) 1 1) 1 1) 5. Which of the aswers below is 5 i=1 i? Which of the aswers below is i=1 i 1)? Which of the aswers below best approximates Oi 5 ) O ) O ) O 5 ) 8. For the fuctios show i Figure, what best describes the order of the fuctio, g)? g) = oh) g) = Oh) g) = Ωh) g) = Θh) 9. Which of the followig is the correct orderig of the fuctios,, 1000,? 1000 < < < < < 1000 < < < < < 10. Which of the followig is the correct orderig of the fuctios log,!, log log, log? S1 = S for 1 0 oly S1 = S for oly S1 = S for all S1 is true, but S is false S1 is false, but S is true log < log < log log <! log < log log < log <! log log < log < log <! log <! < log log < log Let T1) = Of)) ad T) = Of)). Give statemets A) T1) T) = ; ad B) T1) + T) = Of)), which of them are true? 1. Isert your magic umber, N, ito the Biary Search tree show i Figure. Redraw the tree.. Let S1 = i=1 i ad S = i=1 i). Which oe of the followig statemets is true? S1 = S for 1 0 oly S1 = S for oly S1 = S for all 1. I a recet court case, a judge cited a city for cotempt ad ordered a fie of for the first day. Each subsequet day, util the city followed the judge s order, the fie was squared that is, the fie progressed,, 1, 5, 5,5,...). What would be the fie o day?. For your magic umber, M, evaluate 15 M i i= 5. For your magic umber, M, evaluate 55 i M i i=0. O the first day of Christmas, O the secod day of Christmas, Two Zetor tractors, ad O the third day of Christmas... How may lies would be i such a poem if it ra for 5 days istead of the usual 1? 1. What is the time-complexity of computig i=0 aixi if a dumb expoetiatio algorithm is used? Olog ) O log ) O ) Leave your aswer i the form say) )/ ) What is the time-complexity of the followig Sectio 10. Autum 0 Fial, MC 5. What is the time-complexity of the followig for j = 0; j < ; j++) sum = sum + ; O ) Olog ) O log ) 15. What is the time-complexity of cubig A A A) a matrix of size i Big-Oh otatio? Sectio 9. O ) O ) O 5 ) O ) Autum 0 Mid-Term II. Isert your magic umber, N, ito the AVL tree show i Figure. Redraw the tree.. Delete your magic digit, d, from the Biary Search tree show i Figure. Redraw the resultig tree. Use the machie-readable multiple-choice questio grid that has bee provided to aswer these questios. Please completely mark i black exactly oe circle o the grid for each aswer. A pealty will be charged for wrog aswers. Mark the X bubble for those questios you wish to skip. 1. The umber of odes i a complete biary tree exactly h 1 exactly h 1 exactly h+1 1. How may odes are o the bottom layer, h, of a perfect biary tree? at least h at most h exactly h oe of the above O ) Olog ) O log ) The worst-case performaces of the heap operatios deletemi) ad isert) are both Olog ). Give the two statemets below, which of them S1 The experimetally foud average case performace of deletemi) is S The experimetally foud average case performace of isert) is S1 is true, but S is false S1 is false, but S is true 11 1

4 7. Give the two statemets below, which of them S1 I a strogly coected graph, every ode coects to every other ode by a edge S If a graph is strogly coected the it caot have a cut vertex articulatio poit) S1 is true, but S is false S1 is false, but S is true 8. Give the two statemets below, which of them S1 If a -vertex digraph has articulatio poits the the graph must have a cycle S If the Depth-First Tree of a graph G has o back edges the G has o cycles S1 is true, but S is false S1 is false, but S is true 9. Give the two statemets below, which of them S1 Startig from vertex v0 i a graph, the time required by Depth- to fid a path if oe exists) to some vertex v is less tha that required by Breadth- S The space required by Depth- is less tha that required by Breadth- Sectio 11. S1 is true, but S is false S1 is false, but S is true Autum 0 Fial, Shorts Please put your aswers to these questios i the aswer book provided to you, labellig your aswers.1,., etc. 1. The uweighted shortest path problem ca be solved i time.. With calls to percolate dow), a heap ca be created i time.. Give the recurrece relatio for the best-case ruig time of QuickSelect), the algorithm 1 for fidig the k th largest elemet i a array:. Recursio is to algorithm implemetatio as is to proof techiques. That is, what is the proof techique aalogue of recursio? 5. Ordiarily the most appropriate way to represet a graph iterally is with ; however, if may queries are of the form Is ode u adjacat to ode v? the the most appropriate represetatio may be Sectio 1. Autum 0, Mid-Term I 1. Which of the aswers below best describes the th Fiboacci umber, F? ) 5 F 7 ) F 7 ) 7 F 5 ) 7 F. Which of the aswers below best describes the th Fiboacci umber, F? F = O ) F = O ) F = Oa ), a > F = Oa ), a < e). Two sowballs rollig dow differet part of the same hill grow at differet rates. Sowball Flakey grows at a rate so that it triples i size every three hours, while sowball Fluffy quadruples i size every four hours. If they both started rollig at the same time ad they were idetical sizes at the outset ad they reach the bottom together, which will be biggest? Flakey Fluffy They will be idetical sizes Depeds o the sow desity o the hill. Two galaxies i the same uiverse expad at differet rates. Galaxy Deuteroium grows at a rate so that it doubles i size every two years, while galaxy Séamus quadruples i size every four years. If they both started expadig at the same time ad they were idetical sizes at the outset which will be bigger at time T = 00, 000 years? Deuteroium Séamus They will be idetical sizes Caot be determied from the iformatio give 5. Cosider the followig algorithm for solvig jigsaw puzzles with pieces: pick a radom piece p from the box let C, the set of pieces i the completed part of the puzzle, start off as p i. for each of the remaiig pieces i the box, r, i tur, see if it fits ito the completed part C by checkig it agaist all exposed pieces of C ii. if it does, place it i its positio iii. if it does t, retur it ad cosider the ext uplaced piece from the box repeat steps i) to iii) while there is somethig i the box O log ) O ) O ) 1 Cosider the followig differet algorithm for solvig jigsaw puzzles with pieces: pick a radom piece p from the box let C, the set of pieces i the completed part of the puzzle start off as p i. omiate a exposed piece of the completed part of the jigsaw; call it c ii. for each of the remaiig pieces i the box, r, i tur, see if it fits ext to c iii. if it does, place it i its positio iv. if it does t, retur it ad cosider the ext uplaced piece from the box repeat steps i) to iv) while there is somethig still left i the box O log ) O ) O ) 7. Give f) = 0, which of the followig is true? f) = O ) ad f) O ) f) O ) ad f) = O ) f) = O ) ad f) = O ) f) O ) ad f) O ) 8. Which of the aswers below is i=1 i? ) i=1 i ) i=1 i ) i=1 i 9. Which of the followig equals log/) + log/)? log log log ) 10. A geometric series is oe that ca be writte i the form i=0 ari, for some costats a ad r; a arithmetic series is oe that ca be writte i the form i=0 a + id. Is the series i=0 i i a) geometric series arithmetic series geometric ad arithmetic series either geometric or arithmetic series 11. Give some costat k, which of the followig statemets log k ) = ad log k = log k ) ad log k = log k ) = ad log k log k ) ad log k 1. Give a matrix, A, of size, what is the time-complexity of calculatig A 5 i Big-Oh otatio? O ) O ) 1. I a multiple choice exam, if egative markig is beig used, what should be the pealty for wrog aswers so that somebody who guesses throughout eds up with 0; each questio has three possible aswers ad the questios are worth marks each? 1 1. What is the ruig-time i Big-Oh otatio of the followig chuk of code, where b is some it previously give a value? for it j = i; j < /; j += b) arr[i][j] = 0; O log ) O log b ) O ) What is the time-complexity of the followig for it j = i; j < ; j += /) arr[i][j] = 0; Olog ) O log ) O ) 1 Which of the recurrece relatios below best describes the ruig time of followig fuctio sort)? // retur idex of largest el. it fididlargestcost it a[], it s, it e) it li = s; it l = a[li]; for it i = s+1; i < e; i++) if l < a[i]) li = i; l = a[li]; retur li; void swapit& a, it& b) it t = a; a = b; b = t; void sortcost it a[], it ) for it i = 0; i < ; i ++) it li = fididlargesta, i, ); swapa[i], a[li]); T ) = T k) + Sectio 1. T ) = T k) + c T ) = T k) + c T ) = T 1) + c Autum 0, Mid-Term II 1. I a multiple choice exam, if egative markig is beig used, what should be the pealty for wrog aswers so that somebody who guesses throughout eds up with 0; each questio has four possible aswers ad the questios are worth four marks each?. Which of the aswers below is i=0 i?. Which of the aswers below is i= i?. Which of the aswers below is i= i? 1 1) 1 1) 1 1) 5. Which of the aswers below is 5 i=1 i? Which of the aswers below is i=1 i 1)? Which of the aswers below best approximates Oi 5 ) O ) O ) O 5 ) 8. Which of the followig is the correct orderig of the fuctios,, 1000,? 1000 < < < < < 1000 < < < < < 9. Which of the followig is the correct orderig of the fuctios log,!, log log, log? log < log < log log <! log < log log < log <! log log < log < log <! log <! < log log < log If T ) = Of)) the which of the followig is the most precise statemet? T ) = of)) f) = ΩT )) T ) = k f) for some costat k f) = ΘT )) 11. If you fold a A sheet of paper i half you get a A5 sheet. Similarly, a A sheet is twice the size of a A sheet. This cotiues all the way back to the huge sheet A0. How may A5 sheets fit i a A0 sheet? You re uder pressure. It s your tur to make the Suday breakfast ad you have to get the sausages o the pa i a hurry. If you ve got a lik of sausages to cut with a scissors, what is the fewest o. of cuts eeded to separate them ito idividual sausages, without bedig ay of the sausages? 1 log 1 1. Thigs have got costatly worse. The scissors that you were usig is blut ad you ca oly cut a maximum of c sausages at ay oe time with it. How may cuts are ecessary ow? log c c c 1 1. We wat to keep track of the relatioships betwee people, p0, p1,..., p. We create a two-dimesioal array, arr, of bools so that to tell if perso pi is related to pj we check arr[i][j]. There s o eed to check aythig if i = j sice everybody is related to themselves. Sice relatioships are symmetrical, to test if p8 was related to p, we would check arr[][8]. Thus, the etire array is ot eeded. Exactly how may etries of the array are eeded? 1 1) 1

5 15. I the previous questio, suppose the aswer was S). How may differet uique sets of relatios could we have o the people? [Hit: Each uique set of relatios correspods to a uique matrix.] S) S) S) S) S) 1 We wat to fid the largest elemet of a array of umbers, a1,..., a. Assume for hadiess that is a power of.) Our strategy is that we will compare a1 with a, compare a with a, ad, fially, a ad a. That gives us / first roud wiers, f1,..., f, which advace to the ext roud, where they are compared i pairs agai to give secod-roud wiers. This cotiues util there is a wier of the fial, the largest elemet. If this scheme is to work the it will have to perform at least how may comparisos i fidig the champio? Ω1) Ωlog ) Ω 1) Ω) 17. What is the recommeded maximum load factor, λ, for a closed hash table? λ > 0 λ < 0.5 λ < 1 0 < λ < The load factor, λ, of a hash table is defied to be the ratio of etries to table size. Whe does this formula hold? For closed hash tables but ot for ope hash tables For ope hash tables but ot for closed hash tables For both ope ad closed hash tables For either ope or closed hash tables 19. What is the expected time for isertio ito a hash table with load factor, λ, usig liear probig? 1 1 λ) 1 λ) λ) ) 1 λ) ) I a d-ary heap, where will you beig ode i fid your paret? Sectio 1. d i d d i d i d + 1 i+d d Autum 0, Fial 1. I a AVL tree of height h, the umber of probes made i a usuccessful search will be Olog ) Depeds o the way the AVL was first created. Give f) = ad g) =, which oe of the followig statemets is false. f) = Og)) f) = Ωf)) f) = Θf)) f) = og)). How may multiplicatios are used i the calculatio of X, usig the fast expoetiatio algorithm? Olog ) O ) O!). What is the vertex-coectivity of the graph draw i Figure 5? 5 5. How may cut vertices does the graph draw i Figure 5 have? 1 5 O iput of size N, the ruig time of programs A is always less tha 1 N. O iput of size N, the ruig time of program B is always less tha 1 log N ). Is the average ruig time of program A greater tha the average ruig time of program B, for N = 100, 000. Yes, the average ruig time of program A is greater tha the average ruig time of program B No, the average ruig time of program A equals the average ruig time of B, for N = 100, 000 No, the average ruig time of program B is greater tha the average ruig time of program A, for N = 100, 000 There is ot eough iformatio to tell 7. Cosider what happes after is iserted ito the AVL tree draw i Figure The tree becomes ubalaced ad eeds to be re-balaced usig a sigle-rotatio. Followig this siglerotatio what odes), if ay, are the childre of? ode 7 ad ode 8 just ode 7 just ode 8 ode will have o childre 8. Cosider a arbitrary biary tree B where every ode is either full or is a leaf. Let F represet the umber of full odes i B ad let L represet the umber of leaves i B. Recall a full ode is a ode with two childre, ad a leaf is a ode with o childre). Which of the followig statemets is true, o matter what the choice of B? F = L + 1 L = F + 1 L = F F = L 9. For which of the followig sortig algorithms, is it importat that the iput is radom rather tha presorted or i reverse order for example)? quicksort, where the first elemet is chose as the pivot quicksort, where the pivot is chose usig media-of-three partitioig mergesort isertio sort The two formulae we have see regardig the expected umber of probes of hash table operatios usig liear probig are 1 1 λ) ad, 1 operatios are give by them? Sectio λ) ). Which : successful searches; isertios : isertios; successful searches : successful searches; usuccessful searches : usuccessful searches; isertios Autum 0, Fial Shorts) 1. Whe solvig the weighted shortest path a priority queue is used but uses a o-stadard operatio. What is this o-stadard operatio?.. I O-otatio, what is the aalogue of a lieartime algorithm if the iput is a graph G = V, E)?.. The height of a AVL tree is o worse tha times the optimal height.. Give a graph, G = V, E), what is the largest umber of edges exactly a graph ca have i terms of V, the umber of odes?. 5. Ordiarily the most appropriate way to represet a graph iterally is with ; however, if may queries are of the form Is ode u adjacat to ode v? the the most appropriate represetatio may be Sectio 1 Term Sprig 00/007, Mid- 1. Which of the aswers below is i= i? 1 1) 1 1) 1 1). Which of the aswers below best approximates O ) Oi 5 ) O 5 ) O ). A -time algorithm sortig itegers i the rage [0, 1] is possible by makig 8 passes of radix sort, with buckets of size /1 / 1 8. The time-complexity of expoetiatio to the power of is most precisely) Olog ) o) Θ) 5. What is the desired upper limit o the load factor, λ, for ope hashig? λ.0 λ 1.0 λ 0.5 λ 0.0 How may bits are required per ode to store the height of a ode i a -ode AVL tree? log log log log 7. How may odes are o the bottom layer, h, of a complete biary tree? at least h at most h exactly h oe of the above 8. Which of the aswers below is log b x? log x log b log b log x log x 9. Usig m buckets, bucket sort has timecomplexity Om ) Om + ) Om ) O m ) 10. Ruig-time Om + ) is equivalet to A) Om) + or, B) Omaxm, )). Which of these possiblities are correct? 11. Give f) = ad g) =, which oe of the followig statemets is false. f) = Og)) f) = Ωf)) f) = Θf)) f) = og)) 1. How may multiplicatios are used i the calculatio of X, usig the fast expoetiatio algorithm? O!) O ) Olog ) 1. The load factor, λ, of a hash table is defied to be the ratio of etries to table size. Whe does this formula hold? For closed hash tables but ot for ope hash tables For ope hash tables but ot for closed hash tables For both ope ad closed hash tables For either ope or closed hash tables 1. What is the expected time for isertio ito a hash table with load factor, λ, usig liear probig? 1 1 λ) 1 λ) λ) ) 1 λ) ) 15. We wat to keep track of the relatioships betwee people, p0, p1,..., p. We create a two-dimesioal array, arr, of bools so that to tell if perso pi is related to pj we check arr[i][j]. There s o eed to check aythig if i = j sice everybody is related to themselves. Sice relatioships are symmetrical, to test if p8 was related to p, we would check arr[][8]. Thus, the etire array is ot eeded. Exactly how may etries of the array are eeded? 1 1) 1 1 I the previous questio, suppose the aswer was S). How may differet uique sets of relatios could we have o the people? [Hit: Each uique set of relatios correspods to a uique matrix.] S) S) S) S) S) 17. We wat to fid the largest elemet of a array of umbers, a1,..., a. Assume for hadiess that is a power of.) Our strategy is that we will compare a1 with a, compare a with a, ad, fially, a ad a. That gives us / first roud wiers, f1,..., f, which advace to the ext roud, where they are compared i pairs agai to give secod-roud wiers. This cotiues util there is a wier of the fial, the largest elemet. If this scheme is to work the it will have to perform at least how may comparisos i fidig the champio? Ω1) Ωlog ) Ω 1) Ω) 18. I a AVL tree of height h, the umber of probes made i a successful search will be most accurately) Olog ) Sectio 17. Depeds o the way the AVL was created Sprit , Fial 1. The umber of odes i a complete biary tree exactly h 1 exactly h 1 exactly h+1 1. How may odes are o the bottom layer, h, of a perfect biary tree? at least h at most h exactly h oe of the above. Let S1 = i=1 i ad S = i=1 i). Which oe of the followig statemets is true? S1 = S for 1 0 oly S1 = S for oly S1 = S for all. O the first day of Christmas, O the secod day of Christmas, Two Zetor tractors, ad O the third day of Christmas... How may lies would be i such a poem if it ra for 5 days istead of the usual 1? What is the time-complexity of the followig O ) Olog ) O log ) 19 0

6 The worst-case performaces of the heap operatios deletemi) ad isert) are both Term Sectio 18. Olog ). Give the two statemets below, which of them S1 The experimetally foud average case performace of deletemi) is S The experimetally foud average case performace of isert) is S1 is true, but S is false S1 is false, but S is true 7. Give the two statemets below, which of them S1 I a strogly coected graph, every ode coects to every other ode by a edge S If a graph is strogly coected the it caot have a cut vertex articulatio poit) S1 is true, but S is false S1 is false, but S is true 8. Give the two statemets below, which of them S1 If a -vertex digraph has articulatio poits the the graph must have a cycle S If the Depth-First Tree of a graph G has o back edges the G has o cycles S1 is true, but S is false S1 is false, but S is true 9. Give the two statemets below, which of them S1 Startig from vertex v0 i a graph, the time required by Depth- to fid a path if oe exists) to some vertex v is less tha that required by Breadth- S The space required by Depth- is less tha that required by Breadth- S1 is true, but S is false S1 is false, but S is true 1 Sprig 010/011, Mid- 1. I a multiple choice exam, if egative markig is beig used, what should be the pealty for wrog aswers so that somebody who guesses throughout eds up with 0; each questio has four possible aswers ad the questios are worth four marks each?. Which of the aswers below is i=0 i?. Which of the aswers below is i= i?. Which of the aswers below is i= i? 1 1) 1 1) 1 1) 5. Which of the aswers below is 5 i=1 i? Which of the aswers below is i=1 i 1)? Which of the aswers below best approximates Oi 5 ) O ) O ) O 5 ) 8. Which of the followig is the correct orderig of the fuctios,, 1000,? 1000 < < < < < 1000 < < < < < 9. Which of the followig is the correct orderig of the fuctios log,!, log log, log? log < log < log log <! log < log log < log <! log log < log < log <! log <! < log log < log 10. If T ) = Of)) the which of the followig is the most precise statemet? T ) = of)) f) = ΩT )) T ) = k f) for some costat k f) = ΘT )) 11. If T ) = Θf)) the which of the followig is the most precise statemet? T ) = Of)) ad T ) = Ωf)) T ) = Of)) but ot T ) = Ωf)) T ) = of)) ad T ) = Ωf)) T ) = of)) but ot T ) = Θf)) 1. If m = Θ) the bucket sort has timecomplexity most precisely) O ) Ω) Ω ) 1. A -time algorithm sortig itegers i the rage [0, 1] is possible by makig passes of radix sort, with buckets of size / / 8 1. The time-complexity of expoetiatio to the power of is most precisely) Olog ) o) Θ) 15. What is the time-complexity of computig i=0 aixi if a aïve expoetiatio algorithm is used? Olog ) O log ) O ) 1 The time-complexity of searchig for a item amogst a array of sorted items is most precisely) Θ log ) olog ) Olog ) Ωlog ) 17. What is the time-complexity of the followig sum = sum + ; O ) Olog ) O log ) 18. What is the time-complexity of the followig for it j = 0; j < ; j = j*) sum = sum + ; O ) Olog ) O log ) 19. What is the time-complexity of the followig for it j = 0; j < ; j++) sum = sum + ; O ) Olog ) O log ) 0. What is the time-complexity of squarig a matrix of size i Big-Oh otatio? O ) O ) O log ) 1. For the AVL Tree show i Figure 1, what type of rotatio would be required i order to isert the value 1? A left rotatio A right rotatio A right-left rotatio A left-right rotatio. For the Biary Tree show i Figure 1, which of the followig represets a post-order traversal? 11,1,9,8,10,5,,,,7 7,,10,,5,8,1,,9,11 7,,,,5,10,8,9,1,11.. For the Biary Search Tree show i Figure 1, deletio of ode 7 would result i which of the followig odes becomig the root ode? 10 or 10 5 or 8. Two sowballs rollig dow differet parts of the same hill grow at differet rates. Sowball Flakey grows at a rate so that it triples i size every three hours, while sowball Fluffy quadruples i size every four hours. If they both started rollig at the same time ad they were idetical sizes at the outset ad they reach the bottom together, which will be biggest? The depth of sow is the same all over the hill.) Flakey Fluffy They will be idetical sizes Depeds o the sow desity o the hill 5. Two galaxies i the same uiverse expad at differet rates. Galaxy Deuteroium grows at a rate so that it doubles i size every two years, while galaxy Séamus quadruples i size every four years. If they both started expadig at the same time ad they were idetical sizes at the outset which will be bigger at time T = 00, 000 years? Sectio 19. Deuteroium Séamus They will be idetical sizes Caot be determied from the iformatio give Sprig 010/011, Fial Use the machie-readable multiple-choice questio grid that has bee provided to aswer these questios. Please completely mark i black exactly oe circle o the grid for each aswer. A pealty will be charged for wrog aswers. Mark the X bubble for those questios you wish to skip. 1. What is the time-complexity of the followig for j = 1; j < ; j = j*) sum = sum + ; O ) O log ) Olog ). The worst-case performaces of the heap operatios deletemi) ad isert) are both Olog ). Give the two statemets below, which of them S1 The experimetally foud average case performace of deletemi) is S The experimetally foud average case performace of isert) is S1 is true, but S is false S1 is false, but S is true. The umber of odes i a complete biary tree exactly h 1 exactly h 1 exactly h+1 1. How may odes are o the bottom layer, h, of a perfect biary tree? exactly h at least h at most h oe of the above 5. Let S1 = i=1 i ad S = i=1 i). Which oe of the followig statemets is true? S1 = S for 1 0 oly S1 = S for oly S1 = S for all O the first day of Christmas, O the secod day of Christmas, Two Zetor tractors, ad O the third day of Christmas... How may lies would be i such a poem if it ra for 5 days istead of the usual 1? Give the two statemets below, which of them S1 I a strogly coected graph, every ode coects to every other ode by a directed edge S If a graph is strogly coected the it caot have a cut vertex articulatio poit) S1 is true, but S is false S1 is false, but S is true 8. Give the two statemets below, which of them S1 If a -vertex digraph has articulatio poits the the graph must have a cycle S If the Depth-First Tree of a graph G has o back edges the G has o cycles S1 is true, but S is false S1 is false, but S is true 9. Give the two statemets below, which of them S1 Startig from vertex v0 i a graph, the time required by Depth- to fid a path if oe exists) to some vertex v is less tha that required by Breadth- S The space required by Depth- is less tha that required by Breadth- Sectio 0. Term S1 is true, but S is false S1 is false, but S is true Sprig 011/01, Mid- 1. I a multiple choice exam, if egative markig is beig used, what should be the pealty for wrog aswers so that somebody who guesses throughout eds up with 0? Each questio has four possible aswers ad the questios are worth 5 marks each Which of the aswers below is i=0 i?. Which of the aswers below is i= i? 1 1

7 . Which of the aswers below is +1 i= i? 5 1) 1 5 1) 1 5 1) 5. Which of the aswers below is log b x? log b log x log x log b log x Which of the aswers below is i=1 i 1)? Which of the aswers below best approximates Oi 5 ) O ) Oi ) 8. Which of the followig best approximates i=1 1 i? 1 log e log e 9. Which of the followig is a correct represetatio of a b ) c? a b+c a cb 10. Ruig-time Om + ) is equivalet to A Om) + B Omaxm, )) Which of these possiblities are correct? 11. What is the ruig-time i Big-Oh otatio of the followig chuk of code? i = -i; O ) O log ) 1. What is the ruig-time i Big-Oh otatio of the followig chuk of code? for it i = 0; i < *; i++) sum += sum+i; O ) O log ) 1. Let T1) = Of)) ad T) = Of)). Give statemets A T1) T) = ; B T1) + T) = Of)) which of them 1. I a recet court case, a judge cited a city for cotempt ad ordered a fie of for the first day. Each subsequet day, util the city followed the judge s order, the fie was squared that is, the fie progressed,, 1, 5, 5,5,...). What would be the fie o day? 15. The time-complexity of expoetiatio to the power of is most precisely) 1 The time-complexity of searchig for a item amogst a array of sorted items is most precisely) Θ log ) olog ) Olog ) Ωlog ) 17. What is the time-complexity of the followig sum += sum+; O ) Olog ) O log ) 18. What is the time-complexity of the followig for j = 1; j < ; j = j*) sum += ; O ) Olog ) O log ) 19. What is the time-complexity of the followig for j = 0; j < ; j++) sum += ; O ) Olog ) O log ) 0. What is the time-complexity of squarig a matrix of size i Big-Oh otatio? 1. For the Biary Tree show i Figure 1, which of the followig represets a post-order traversal? 11,1,9,8,10,5,,,,7 7,,10,,5,8,1,,9,11 7,,,,5,10,8,9,1,11.. For the Biary Search Tree show i Figure 1, deletio of ode 7 would result i which of the followig odes becomig the root ode? 10 or 10 5 or 8. For the Biary Search Tree show i Figure 1, deletio of ode 7 would result i the iorder traversal beig which of the followig?, 10,, 5, 8, 1,, 9, 11 10,, 1, 8, 5,, 11, 9,,, 10,, 5, 8, 1,, 9, 11,,, 5, 8, 9, 10, 11, 1. Which is larger, 18 9 or 9 18? They are both the same We did t do a problem like this before 5. How may odes are cotaied i a perfect terary -way) tree of height k levels 0... k)? k k k+1 How may odes are cotaied i the lowest layer of a perfect terary -way) tree of height k levels 0... k)? Olog ) o) Θ) O ) O ) O log ) k k k k How may odes are cotaied i layers 10 to of a perfect terary -way) tree of height 0 levels )? The best aswer below is: All three of the followig aswers ) 8. The Fiboacci umbers obey the recurrece relatio F = F + F,, F0 = F1 = 1 Which oe of the followig statemets is false? F+1 = F + F, 1 F+ = F+1 + F, 0 F = 1 + i=0 Fi, F =, 0 I the followig two questios BST<Comparable> is a Biary Search Tree C++ class ito which you may isert objects that are comparable, that is, it is possible to decide amogst two which is larger ad smaller. Each ode of this tree will be a class, BNode, with a poiters to the left ad right subtrees, ->left ad ->right, respectively. 9. What does the fuctio what) below, or, more accurately, the member fuctio BST<Comparable>::what)), perform? BNode<Comparable> * BST<Comparable>::what BNode<Comparable> *t ) if t == NULL ) retur NULL; if t->left == NULL ) retur t; else retur what t->left ); Cout the umber of NULL odes i the Fid the leftmost ode i the tree rooted at t Fid a ode smaller tha t Fid a ode larger tha t 7 0. What does the member) fuctio whatever) below, perform? The fuctio max) returs the larger of two umbers. it BST<Comparable>::whatEver BNode<Comparable> *t ) if t == NULL ) retur 0; it l = whatevert->left); it r = whatevert->right); it m = maxl, r); // larger of two its retur m+1; Sectio 1. Cout the umber of NULL odes i the Cout the umber of o-null odes i the Compute the height of the tree rooted at t Compute the age of the tree rooted at t Sprig 011/01, Fial 1. Which of the aswers below is i=0 i?. Which of the aswers below is i= i? 1 1. Which of the aswers below is +1 i= i? 5 1) 1 5 1) 1 5 1). Which of the aswers below is log b x? log b log x log x log b log x 5. Which of the aswers below is i=1 i 1)? Which of the aswers below best approximates Oi 5 ) O ) Oi ) 7. Which of the followig best approximates i=1 1 i? 1 log e log e 8. Ruig-time Om + ) is equivalet to A Om) + B Omaxm, )) Which of these possiblities are correct? 9. What is the ruig-time i Big-Oh otatio of the followig chuk of code? i = -i; O ) O log ) 10. Let T1) = Of)) ad T) = Of)). Give statemets A T1) T) = ; B T1) + T) = Of)) which of them The time-complexity of searchig for a item amogst a array of sorted items is most precisely) Θ log ) olog ) Olog ) Ωlog ) 1. What is the time-complexity of the followig for j = 1; j < ; j = j*) sum += ; O ) Olog ) O log ) 1. Which is larger, 18 9 or 9 18? They are both the same I the limit they will differ oly slightly 1. How may odes are cotaied i a perfect terary -way) tree of height k levels 0... k)? k k k How may odes are cotaied i the lowest layer of a perfect terary -way) tree of height k levels 0... k)? k k k k+1 1 How may odes are cotaied i layers 10 to of a perfect terary -way) tree of height 0 levels )? The best aswer below is: All three of the followig aswers ) I the followig three questios BST<Comparable> is a Biary Search Tree C++ class ito which you may

8 isert objects that are comparable, that is, it is possible to decide amogst two which is larger ad smaller. Each ode of this tree will be a class, BNode, with a poiters to the left ad right subtrees, ->left ad ->right, respectively. 17. What does the fuctio what) below, or, more accurately, the member fuctio BST<Comparable>::what)), perform? BNode<Comparable> * BST<Comparable>::what BNode<Comparable> *t ) if t == NULL ) retur NULL; if t->left == NULL ) retur t; else retur what t->left ); Cout the umber of NULL odes i the Fid the leftmost ode i the tree rooted at t Fid a ode smaller tha t Fid a ode larger tha t 18. What does the member) fuctio whatever) below, perform? The fuctio max) returs the larger of two umbers. it BST<Comparable>::whatEver BNode<Comparable> *t ) if t == NULL ) retur 0; 19. What does the member) fuctio whatnow) below, perform? it BST<Comparable>::whatNow BNode<Comparable> *t ) if t == NULL ) retur 0; retur whatnowt->left) + whatnowt->right) + 1; Cout the umber of NULL odes i the Cout the umber of o-null odes i the Compute the height of the tree rooted at t Compute the age of the tree rooted at t 0. The Fiboacci umbers obey the recurrece relatio F = F + F,, F0 = F1 = 1 Which oe of the followig statemets is false? F+1 = F + F, 1 F+ = F+1 + F, 0 F = 1 + i=0 Fi, F =, 0 Figure 1: A Biary Search / AVL / Splay Tree Figure : Some fuctios it l = whatevert->left); it r = whatevert->right); it m = maxl, r); // larger of two its retur m+1; Cout the umber of NULL odes i the Cout the umber of o-null odes i the Compute the height of the tree rooted at t Compute the age of the tree rooted at t 9 0 Figure : A Biary Search / AVL Tree Figure : A Biary Search Tree A -regular graph. A graph with cutvertices. Figure 5: Some example graphs. Figure : A AVL Tree. 1

CS161: Algorithm Design and Analysis Handout #10 Stanford University Wednesday, 10 February 2016

CS161: Algorithm Design and Analysis Handout #10 Stanford University Wednesday, 10 February 2016 CS161: Algorithm Desig ad Aalysis Hadout #10 Staford Uiversity Wedesday, 10 February 2016 Lecture #11: Wedesday, 10 February 2016 Topics: Example midterm problems ad solutios from a log time ago Sprig

More information

CS 332: Algorithms. Linear-Time Sorting. Order statistics. Slide credit: David Luebke (Virginia)

CS 332: Algorithms. Linear-Time Sorting. Order statistics. Slide credit: David Luebke (Virginia) 1 CS 332: Algorithms Liear-Time Sortig. Order statistics. Slide credit: David Luebke (Virgiia) Quicksort: Partitio I Words Partitio(A, p, r): Select a elemet to act as the pivot (which?) Grow two regios,

More information

Sorting Algorithms. Algorithms Kyuseok Shim SoEECS, SNU.

Sorting Algorithms. Algorithms Kyuseok Shim SoEECS, SNU. Sortig Algorithms Algorithms Kyuseo Shim SoEECS, SNU. Desigig Algorithms Icremetal approaches Divide-ad-Coquer approaches Dyamic programmig approaches Greedy approaches Radomized approaches You are ot

More information

4.3 Growth Rates of Solutions to Recurrences

4.3 Growth Rates of Solutions to Recurrences 4.3. GROWTH RATES OF SOLUTIONS TO RECURRENCES 81 4.3 Growth Rates of Solutios to Recurreces 4.3.1 Divide ad Coquer Algorithms Oe of the most basic ad powerful algorithmic techiques is divide ad coquer.

More information

Analysis of Algorithms. Introduction. Contents

Analysis of Algorithms. Introduction. Contents Itroductio The focus of this module is mathematical aspects of algorithms. Our mai focus is aalysis of algorithms, which meas evaluatig efficiecy of algorithms by aalytical ad mathematical methods. We

More information

OPTIMAL ALGORITHMS -- SUPPLEMENTAL NOTES

OPTIMAL ALGORITHMS -- SUPPLEMENTAL NOTES OPTIMAL ALGORITHMS -- SUPPLEMENTAL NOTES Peter M. Maurer Why Hashig is θ(). As i biary search, hashig assumes that keys are stored i a array which is idexed by a iteger. However, hashig attempts to bypass

More information

Test One (Answer Key)

Test One (Answer Key) CS395/Ma395 (Sprig 2005) Test Oe Name: Page 1 Test Oe (Aswer Key) CS395/Ma395: Aalysis of Algorithms This is a closed book, closed otes, 70 miute examiatio. It is worth 100 poits. There are twelve (12)

More information

CS / MCS 401 Homework 3 grader solutions

CS / MCS 401 Homework 3 grader solutions CS / MCS 401 Homework 3 grader solutios assigmet due July 6, 016 writte by Jāis Lazovskis maximum poits: 33 Some questios from CLRS. Questios marked with a asterisk were ot graded. 1 Use the defiitio of

More information

1 Hash tables. 1.1 Implementation

1 Hash tables. 1.1 Implementation Lecture 8 Hash Tables, Uiversal Hash Fuctios, Balls ad Bis Scribes: Luke Johsto, Moses Charikar, G. Valiat Date: Oct 18, 2017 Adapted From Virgiia Williams lecture otes 1 Hash tables A hash table is a

More information

CS 270 Algorithms. Oliver Kullmann. Growth of Functions. Divide-and- Conquer Min-Max- Problem. Tutorial. Reading from CLRS for week 2

CS 270 Algorithms. Oliver Kullmann. Growth of Functions. Divide-and- Conquer Min-Max- Problem. Tutorial. Reading from CLRS for week 2 Geeral remarks Week 2 1 Divide ad First we cosider a importat tool for the aalysis of algorithms: Big-Oh. The we itroduce a importat algorithmic paradigm:. We coclude by presetig ad aalysig two examples.

More information

COMP285 Midterm Exam Department of Mathematics

COMP285 Midterm Exam Department of Mathematics COMP85 Midterm Exam Departmet of Mathematics Fall 010/011 - November 8, 010 Name: Studet Number: Please fiish withi 90 miutes. All poits above 100 are cosidered as bous poit. You ca reach maximal 1 poits.

More information

This Lecture. Divide and Conquer. Merge Sort: Algorithm. Merge Sort Algorithm. MergeSort (Example) - 1. MergeSort (Example) - 2

This Lecture. Divide and Conquer. Merge Sort: Algorithm. Merge Sort Algorithm. MergeSort (Example) - 1. MergeSort (Example) - 2 This Lecture Divide-ad-coquer techique for algorithm desig. Example the merge sort. Writig ad solvig recurreces Divide ad Coquer Divide-ad-coquer method for algorithm desig: Divide: If the iput size is

More information

CSE 4095/5095 Topics in Big Data Analytics Spring 2017; Homework 1 Solutions

CSE 4095/5095 Topics in Big Data Analytics Spring 2017; Homework 1 Solutions CSE 09/09 Topics i ig Data Aalytics Sprig 2017; Homework 1 Solutios Note: Solutios to problems,, ad 6 are due to Marius Nicolae. 1. Cosider the followig algorithm: for i := 1 to α log e do Pick a radom

More information

Infinite Sequences and Series

Infinite Sequences and Series Chapter 6 Ifiite Sequeces ad Series 6.1 Ifiite Sequeces 6.1.1 Elemetary Cocepts Simply speakig, a sequece is a ordered list of umbers writte: {a 1, a 2, a 3,...a, a +1,...} where the elemets a i represet

More information

CS583 Lecture 02. Jana Kosecka. some materials here are based on E. Demaine, D. Luebke slides

CS583 Lecture 02. Jana Kosecka. some materials here are based on E. Demaine, D. Luebke slides CS583 Lecture 02 Jaa Kosecka some materials here are based o E. Demaie, D. Luebke slides Previously Sample algorithms Exact ruig time, pseudo-code Approximate ruig time Worst case aalysis Best case aalysis

More information

Advanced Course of Algorithm Design and Analysis

Advanced Course of Algorithm Design and Analysis Differet complexity measures Advaced Course of Algorithm Desig ad Aalysis Asymptotic complexity Big-Oh otatio Properties of O otatio Aalysis of simple algorithms A algorithm may may have differet executio

More information

Sequences, Mathematical Induction, and Recursion. CSE 2353 Discrete Computational Structures Spring 2018

Sequences, Mathematical Induction, and Recursion. CSE 2353 Discrete Computational Structures Spring 2018 CSE 353 Discrete Computatioal Structures Sprig 08 Sequeces, Mathematical Iductio, ad Recursio (Chapter 5, Epp) Note: some course slides adopted from publisher-provided material Overview May mathematical

More information

Model of Computation and Runtime Analysis

Model of Computation and Runtime Analysis Model of Computatio ad Rutime Aalysis Model of Computatio Model of Computatio Specifies Set of operatios Cost of operatios (ot ecessarily time) Examples Turig Machie Radom Access Machie (RAM) PRAM Map

More information

Model of Computation and Runtime Analysis

Model of Computation and Runtime Analysis Model of Computatio ad Rutime Aalysis Model of Computatio Model of Computatio Specifies Set of operatios Cost of operatios (ot ecessarily time) Examples Turig Machie Radom Access Machie (RAM) PRAM Map

More information

Recursive Algorithms. Recurrences. Recursive Algorithms Analysis

Recursive Algorithms. Recurrences. Recursive Algorithms Analysis Recursive Algorithms Recurreces Computer Sciece & Egieerig 35: Discrete Mathematics Christopher M Bourke cbourke@cseuledu A recursive algorithm is oe i which objects are defied i terms of other objects

More information

Data Structures Lecture 9

Data Structures Lecture 9 Fall 2017 Fag Yu Software Security Lab. Dept. Maagemet Iformatio Systems, Natioal Chegchi Uiversity Data Structures Lecture 9 Midterm o Dec. 7 (9:10-12:00am, 106) Lec 1-9, TextBook Ch1-8, 11,12 How to

More information

Hashing and Amortization

Hashing and Amortization Lecture Hashig ad Amortizatio Supplemetal readig i CLRS: Chapter ; Chapter 7 itro; Sectio 7.. Arrays ad Hashig Arrays are very useful. The items i a array are statically addressed, so that isertig, deletig,

More information

Classification of problem & problem solving strategies. classification of time complexities (linear, logarithmic etc)

Classification of problem & problem solving strategies. classification of time complexities (linear, logarithmic etc) Classificatio of problem & problem solvig strategies classificatio of time complexities (liear, arithmic etc) Problem subdivisio Divide ad Coquer strategy. Asymptotic otatios, lower boud ad upper boud:

More information

Data Structures and Algorithm. Xiaoqing Zheng

Data Structures and Algorithm. Xiaoqing Zheng Data Structures ad Algorithm Xiaoqig Zheg zhegxq@fudaeduc What are algorithms? A sequece of computatioal steps that trasform the iput ito the output Sortig problem: Iput: A sequece of umbers

More information

Injections, Surjections, and the Pigeonhole Principle

Injections, Surjections, and the Pigeonhole Principle Ijectios, Surjectios, ad the Pigeohole Priciple 1 (10 poits Here we will come up with a sloppy boud o the umber of parethesisestigs (a (5 poits Describe a ijectio from the set of possible ways to est pairs

More information

6.3 Testing Series With Positive Terms

6.3 Testing Series With Positive Terms 6.3. TESTING SERIES WITH POSITIVE TERMS 307 6.3 Testig Series With Positive Terms 6.3. Review of what is kow up to ow I theory, testig a series a i for covergece amouts to fidig the i= sequece of partial

More information

Algorithms and Data Structures Lecture IV

Algorithms and Data Structures Lecture IV Algorithms ad Data Structures Lecture IV Simoas Šalteis Aalborg Uiversity simas@cs.auc.dk September 5, 00 1 This Lecture Aalyzig the ruig time of recursive algorithms (such as divide-ad-coquer) Writig

More information

NICK DUFRESNE. 1 1 p(x). To determine some formulas for the generating function of the Schröder numbers, r(x) = a(x) =

NICK DUFRESNE. 1 1 p(x). To determine some formulas for the generating function of the Schröder numbers, r(x) = a(x) = AN INTRODUCTION TO SCHRÖDER AND UNKNOWN NUMBERS NICK DUFRESNE Abstract. I this article we will itroduce two types of lattice paths, Schröder paths ad Ukow paths. We will examie differet properties of each,

More information

Analysis of Algorithms -Quicksort-

Analysis of Algorithms -Quicksort- Aalysis of Algorithms -- Adreas Ermedahl MRTC (Mälardales Real-Time Research Ceter) adreas.ermedahl@mdh.se Autum 2004 Proposed by C.A.R. Hoare i 962 Worst- case ruig time: Θ( 2 ) Expected ruig time: Θ(

More information

Department of Informatics Prof. Dr. Michael Böhlen Binzmühlestrasse Zurich Phone:

Department of Informatics Prof. Dr. Michael Böhlen Binzmühlestrasse Zurich Phone: Departmet of Iformatics Prof. Dr. Michael Böhle Bizmühlestrasse 14 8050 Zurich Phoe: +41 44 635 4333 Email: boehle@ifi.uzh.ch Iformatik II Midterm1 Sprig 018 3.03.018 Advice You have 90 miutes to complete

More information

Definitions: Universe U of keys, e.g., U N 0. U very large. Set S U of keys, S = m U.

Definitions: Universe U of keys, e.g., U N 0. U very large. Set S U of keys, S = m U. 7 7 Dictioary: S.isertx): Isert a elemet x. S.deletex): Delete the elemet poited to by x. S.searchk): Retur a poiter to a elemet e with key[e] = k i S if it exists; otherwise retur ull. So far we have

More information

A recurrence equation is just a recursive function definition. It defines a function at one input in terms of its value on smaller inputs.

A recurrence equation is just a recursive function definition. It defines a function at one input in terms of its value on smaller inputs. CS23 Algorithms Hadout #6 Prof Ly Turbak September 8, 200 Wellesley College RECURRENCES This hadout summarizes highlights of CLRS Chapter 4 ad Appedix A (CLR Chapters 3 & 4) Two-Step Strategy for Aalyzig

More information

(ii) Two-permutations of {a, b, c}. Answer. (B) P (3, 3) = 3! (C) 3! = 6, and there are 6 items in (A). ... Answer.

(ii) Two-permutations of {a, b, c}. Answer. (B) P (3, 3) = 3! (C) 3! = 6, and there are 6 items in (A). ... Answer. SOLUTIONS Homewor 5 Due /6/19 Exercise. (a Cosider the set {a, b, c}. For each of the followig, (A list the objects described, (B give a formula that tells you how may you should have listed, ad (C verify

More information

Divide & Conquer. Divide-and-conquer algorithms. Conventional product of polynomials. Conventional product of polynomials.

Divide & Conquer. Divide-and-conquer algorithms. Conventional product of polynomials. Conventional product of polynomials. Divide-ad-coquer algorithms Divide & Coquer Strategy: Divide the problem ito smaller subproblems of the same type of problem Solve the subproblems recursively Combie the aswers to solve the origial problem

More information

Problem Set 2 Solutions

Problem Set 2 Solutions CS271 Radomess & Computatio, Sprig 2018 Problem Set 2 Solutios Poit totals are i the margi; the maximum total umber of poits was 52. 1. Probabilistic method for domiatig sets 6pts Pick a radom subset S

More information

The Random Walk For Dummies

The Random Walk For Dummies The Radom Walk For Dummies Richard A Mote Abstract We look at the priciples goverig the oe-dimesioal discrete radom walk First we review five basic cocepts of probability theory The we cosider the Beroulli

More information

Math 113 Exam 3 Practice

Math 113 Exam 3 Practice Math Exam Practice Exam will cover.-.9. This sheet has three sectios. The first sectio will remid you about techiques ad formulas that you should kow. The secod gives a umber of practice questios for you

More information

KNOWLEDGE OF NUMBER SENSE, CONCEPTS, AND OPERATIONS

KNOWLEDGE OF NUMBER SENSE, CONCEPTS, AND OPERATIONS DOMAIN I. COMPETENCY.0 MATHEMATICS KNOWLEDGE OF NUMBER SENSE, CONCEPTS, AND OPERATIONS Skill. Apply ratio ad proportio to solve real-world problems. A ratio is a compariso of umbers. If a class had boys

More information

Data Structures and Algorithms

Data Structures and Algorithms Data Structures ad Algorithms Autum 2017-2018 Outlie 1 Sortig Algorithms (cotd) Outlie Sortig Algorithms (cotd) 1 Sortig Algorithms (cotd) Heapsort Sortig Algorithms (cotd) Have see that we ca build a

More information

Divide and Conquer. 1 Overview. 2 Multiplying Bit Strings. COMPSCI 330: Design and Analysis of Algorithms 1/19/2016 and 1/21/2016

Divide and Conquer. 1 Overview. 2 Multiplying Bit Strings. COMPSCI 330: Design and Analysis of Algorithms 1/19/2016 and 1/21/2016 COMPSCI 330: Desig ad Aalysis of Algorithms 1/19/2016 ad 1/21/2016 Lecturer: Debmalya Paigrahi Divide ad Coquer Scribe: Tiaqi Sog 1 Overview I this lecture, a importat algorithm desig techique called divide-ad-coquer

More information

The picture in figure 1.1 helps us to see that the area represents the distance traveled. Figure 1: Area represents distance travelled

The picture in figure 1.1 helps us to see that the area represents the distance traveled. Figure 1: Area represents distance travelled 1 Lecture : Area Area ad distace traveled Approximatig area by rectagles Summatio The area uder a parabola 1.1 Area ad distace Suppose we have the followig iformatio about the velocity of a particle, how

More information

IP Reference guide for integer programming formulations.

IP Reference guide for integer programming formulations. IP Referece guide for iteger programmig formulatios. by James B. Orli for 15.053 ad 15.058 This documet is iteded as a compact (or relatively compact) guide to the formulatio of iteger programs. For more

More information

11. Hash Tables. m is not too large. Many applications require a dynamic set that supports only the directory operations INSERT, SEARCH and DELETE.

11. Hash Tables. m is not too large. Many applications require a dynamic set that supports only the directory operations INSERT, SEARCH and DELETE. 11. Hash Tables May applicatios require a dyamic set that supports oly the directory operatios INSERT, SEARCH ad DELETE. A hash table is a geeralizatio of the simpler otio of a ordiary array. Directly

More information

Algorithm Analysis. Algorithms that are equally correct can vary in their utilization of computational resources

Algorithm Analysis. Algorithms that are equally correct can vary in their utilization of computational resources Algorithm Aalysis Algorithms that are equally correct ca vary i their utilizatio of computatioal resources time ad memory a slow program it is likely ot to be used a program that demads too much memory

More information

In number theory we will generally be working with integers, though occasionally fractions and irrationals will come into play.

In number theory we will generally be working with integers, though occasionally fractions and irrationals will come into play. Number Theory Math 5840 otes. Sectio 1: Axioms. I umber theory we will geerally be workig with itegers, though occasioally fractios ad irratioals will come ito play. Notatio: Z deotes the set of all itegers

More information

Induction: Solutions

Induction: Solutions Writig Proofs Misha Lavrov Iductio: Solutios Wester PA ARML Practice March 6, 206. Prove that a 2 2 chessboard with ay oe square removed ca always be covered by shaped tiles. Solutio : We iduct o. For

More information

CSE 1400 Applied Discrete Mathematics Number Theory and Proofs

CSE 1400 Applied Discrete Mathematics Number Theory and Proofs CSE 1400 Applied Discrete Mathematics Number Theory ad Proofs Departmet of Computer Scieces College of Egieerig Florida Tech Sprig 01 Problems for Number Theory Backgroud Number theory is the brach of

More information

CS:3330 (Prof. Pemmaraju ): Assignment #1 Solutions. (b) For n = 3, we will have 3 men and 3 women with preferences as follows: m 1 : w 3 > w 1 > w 2

CS:3330 (Prof. Pemmaraju ): Assignment #1 Solutions. (b) For n = 3, we will have 3 men and 3 women with preferences as follows: m 1 : w 3 > w 1 > w 2 Shiyao Wag CS:3330 (Prof. Pemmaraju ): Assigmet #1 Solutios Problem 1 (a) Cosider iput with me m 1, m,..., m ad wome w 1, w,..., w with the followig prefereces: All me have the same prefereces for wome:

More information

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER / Statistics

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER / Statistics ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER 1 018/019 DR. ANTHONY BROWN 8. Statistics 8.1. Measures of Cetre: Mea, Media ad Mode. If we have a series of umbers the

More information

CSE 202 Homework 1 Matthias Springer, A Yes, there does always exist a perfect matching without a strong instability.

CSE 202 Homework 1 Matthias Springer, A Yes, there does always exist a perfect matching without a strong instability. CSE 0 Homework 1 Matthias Spriger, A9950078 1 Problem 1 Notatio a b meas that a is matched to b. a < b c meas that b likes c more tha a. Equality idicates a tie. Strog istability Yes, there does always

More information

Lecture 4 February 16, 2016

Lecture 4 February 16, 2016 MIT 6.854/18.415: Advaced Algorithms Sprig 16 Prof. Akur Moitra Lecture 4 February 16, 16 Scribe: Be Eysebach, Devi Neal 1 Last Time Cosistet Hashig - hash fuctios that evolve well Radom Trees - routig

More information

CIS 121 Data Structures and Algorithms with Java Spring Code Snippets and Recurrences Monday, February 4/Tuesday, February 5

CIS 121 Data Structures and Algorithms with Java Spring Code Snippets and Recurrences Monday, February 4/Tuesday, February 5 CIS 11 Data Structures ad Algorithms with Java Sprig 019 Code Sippets ad Recurreces Moday, February 4/Tuesday, February 5 Learig Goals Practice provig asymptotic bouds with code sippets Practice solvig

More information

1. By using truth tables prove that, for all statements P and Q, the statement

1. By using truth tables prove that, for all statements P and Q, the statement Author: Satiago Salazar Problems I: Mathematical Statemets ad Proofs. By usig truth tables prove that, for all statemets P ad Q, the statemet P Q ad its cotrapositive ot Q (ot P) are equivalet. I example.2.3

More information

Chapter 6. Advanced Counting Techniques

Chapter 6. Advanced Counting Techniques Chapter 6 Advaced Coutig Techiques 6.: Recurrece Relatios Defiitio: A recurrece relatio for the sequece {a } is a equatio expressig a i terms of oe or more of the previous terms of the sequece: a,a2,a3,,a

More information

Statistics 511 Additional Materials

Statistics 511 Additional Materials Cofidece Itervals o mu Statistics 511 Additioal Materials This topic officially moves us from probability to statistics. We begi to discuss makig ifereces about the populatio. Oe way to differetiate probability

More information

Chapter 4. Fourier Series

Chapter 4. Fourier Series Chapter 4. Fourier Series At this poit we are ready to ow cosider the caoical equatios. Cosider, for eample the heat equatio u t = u, < (4.) subject to u(, ) = si, u(, t) = u(, t) =. (4.) Here,

More information

Hashing. Algorithm : Design & Analysis [09]

Hashing. Algorithm : Design & Analysis [09] Hashig Algorithm : Desig & Aalysis [09] I the last class Implemetig Dictioary ADT Defiitio of red-black tree Black height Isertio ito a red-black tree Deletio from a red-black tree Hashig Hashig Collisio

More information

Quantum Information & Quantum Computation

Quantum Information & Quantum Computation CS9A, Sprig 5: Quatum Iformatio & Quatum Computatio Wim va Dam Egieerig, Room 59 vadam@cs http://www.cs.ucsb.edu/~vadam/teachig/cs9/ Admiistrivia Do the exercises. Aswers will be posted at the ed of the

More information

Average-Case Analysis of QuickSort

Average-Case Analysis of QuickSort Average-Case Aalysis of QuickSort Comp 363 Fall Semester 003 October 3, 003 The purpose of this documet is to itroduce the idea of usig recurrece relatios to do average-case aalysis. The average-case ruig

More information

P1 Chapter 8 :: Binomial Expansion

P1 Chapter 8 :: Binomial Expansion P Chapter 8 :: Biomial Expasio jfrost@tiffi.kigsto.sch.uk www.drfrostmaths.com @DrFrostMaths Last modified: 6 th August 7 Use of DrFrostMaths for practice Register for free at: www.drfrostmaths.com/homework

More information

Design and Analysis of ALGORITHM (Topic 2)

Design and Analysis of ALGORITHM (Topic 2) DR. Gatot F. Hertoo, MSc. Desig ad Aalysis of ALGORITHM (Topic 2) Algorithms + Data Structures = Programs Lessos Leared 1 Our Machie Model: Assumptios Geeric Radom Access Machie (RAM) Executes operatios

More information

Recursive Algorithm for Generating Partitions of an Integer. 1 Preliminary

Recursive Algorithm for Generating Partitions of an Integer. 1 Preliminary Recursive Algorithm for Geeratig Partitios of a Iteger Sug-Hyuk Cha Computer Sciece Departmet, Pace Uiversity 1 Pace Plaza, New York, NY 10038 USA scha@pace.edu Abstract. This article first reviews the

More information

CSI 5163 (95.573) ALGORITHM ANALYSIS AND DESIGN

CSI 5163 (95.573) ALGORITHM ANALYSIS AND DESIGN CSI 5163 (95.573) ALGORITHM ANALYSIS AND DESIGN CSI 5163 (95.5703) ALGORITHM ANALYSIS AND DESIGN (3 cr.) (T) Topics of curret iterest i the desig ad aalysis of computer algorithms for graphtheoretical

More information

A B = φ No conclusion. 2. (5) List the values of the sets below. Let A = {n 2 : n P n 5} = {1,4,9,16,25} and B = {n 4 : n P n 5} = {1,16,81,256,625}

A B = φ No conclusion. 2. (5) List the values of the sets below. Let A = {n 2 : n P n 5} = {1,4,9,16,25} and B = {n 4 : n P n 5} = {1,16,81,256,625} CPSC 070 Aswer Keys Test # October 1, 014 1. (a) (5) Defie (A B) to be those elemets i set A but ot i set B. Use set membership tables to determie what elemets are cotaied i (A (B A)). Use set membership

More information

Skip Lists. Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015 S 3 S S 1

Skip Lists. Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015 S 3 S S 1 Presetatio for use with the textbook, Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Skip Lists S 3 15 15 23 10 15 23 36 Skip Lists 1 What is a Skip List A skip list for

More information

The Binomial Theorem

The Binomial Theorem The Biomial Theorem Robert Marti Itroductio The Biomial Theorem is used to expad biomials, that is, brackets cosistig of two distict terms The formula for the Biomial Theorem is as follows: (a + b ( k

More information

WORKING WITH NUMBERS

WORKING WITH NUMBERS 1 WORKING WITH NUMBERS WHAT YOU NEED TO KNOW The defiitio of the differet umber sets: is the set of atural umbers {0, 1,, 3, }. is the set of itegers {, 3,, 1, 0, 1,, 3, }; + is the set of positive itegers;

More information

SECTION 1.5 : SUMMATION NOTATION + WORK WITH SEQUENCES

SECTION 1.5 : SUMMATION NOTATION + WORK WITH SEQUENCES SECTION 1.5 : SUMMATION NOTATION + WORK WITH SEQUENCES Read Sectio 1.5 (pages 5 9) Overview I Sectio 1.5 we lear to work with summatio otatio ad formulas. We will also itroduce a brief overview of sequeces,

More information

19.1 The dictionary problem

19.1 The dictionary problem CS125 Lecture 19 Fall 2016 19.1 The dictioary proble Cosider the followig data structural proble, usually called the dictioary proble. We have a set of ites. Each ite is a (key, value pair. Keys are i

More information

HOMEWORK 2 SOLUTIONS

HOMEWORK 2 SOLUTIONS HOMEWORK SOLUTIONS CSE 55 RANDOMIZED AND APPROXIMATION ALGORITHMS 1. Questio 1. a) The larger the value of k is, the smaller the expected umber of days util we get all the coupos we eed. I fact if = k

More information

Solutions to Final Exam

Solutions to Final Exam Solutios to Fial Exam 1. Three married couples are seated together at the couter at Moty s Blue Plate Dier, occupyig six cosecutive seats. How may arragemets are there with o wife sittig ext to her ow

More information

Sums, products and sequences

Sums, products and sequences Sums, products ad sequeces How to write log sums, e.g., 1+2+ (-1)+ cocisely? i=1 Sum otatio ( sum from 1 to ): i 3 = 1 + 2 + + If =3, i=1 i = 1+2+3=6. The ame ii does ot matter. Could use aother letter

More information

MA131 - Analysis 1. Workbook 2 Sequences I

MA131 - Analysis 1. Workbook 2 Sequences I MA3 - Aalysis Workbook 2 Sequeces I Autum 203 Cotets 2 Sequeces I 2. Itroductio.............................. 2.2 Icreasig ad Decreasig Sequeces................ 2 2.3 Bouded Sequeces..........................

More information

DS 100: Principles and Techniques of Data Science Date: April 13, Discussion #10

DS 100: Principles and Techniques of Data Science Date: April 13, Discussion #10 DS 00: Priciples ad Techiques of Data Sciece Date: April 3, 208 Name: Hypothesis Testig Discussio #0. Defie these terms below as they relate to hypothesis testig. a) Data Geeratio Model: Solutio: A set

More information

The Growth of Functions. Theoretical Supplement

The Growth of Functions. Theoretical Supplement The Growth of Fuctios Theoretical Supplemet The Triagle Iequality The triagle iequality is a algebraic tool that is ofte useful i maipulatig absolute values of fuctios. The triagle iequality says that

More information

CS 332: Algorithms. Quicksort

CS 332: Algorithms. Quicksort CS 33: Aorithms Quicsort David Luebe //03 Homewor Assiged today, due ext Wedesday Will be o web page shortly after class Go over ow David Luebe //03 Review: Quicsort Sorts i place Sorts O( ) i the average

More information

Merge and Quick Sort

Merge and Quick Sort Merge ad Quick Sort Merge Sort Merge Sort Tree Implemetatio Quick Sort Pivot Item Radomized Quick Sort Adapted from: Goodrich ad Tamassia, Data Structures ad Algorithms i Java, Joh Wiley & So (1998). Ruig

More information

Trial division, Pollard s p 1, Pollard s ρ, and Fermat s method. Christopher Koch 1. April 8, 2014

Trial division, Pollard s p 1, Pollard s ρ, and Fermat s method. Christopher Koch 1. April 8, 2014 Iteger Divisio Algorithm ad Cogruece Iteger Trial divisio,,, ad with itegers mod Iverses mod Multiplicatio ad GCD Iteger Christopher Koch 1 1 Departmet of Computer Sciece ad Egieerig CSE489/589 Algorithms

More information

Lecture 2: April 3, 2013

Lecture 2: April 3, 2013 TTIC/CMSC 350 Mathematical Toolkit Sprig 203 Madhur Tulsiai Lecture 2: April 3, 203 Scribe: Shubhedu Trivedi Coi tosses cotiued We retur to the coi tossig example from the last lecture agai: Example. Give,

More information

) n. ALG 1.3 Deterministic Selection and Sorting: Problem P size n. Examples: 1st lecture's mult M(n) = 3 M ( È

) n. ALG 1.3 Deterministic Selection and Sorting: Problem P size n. Examples: 1st lecture's mult M(n) = 3 M ( È Algorithms Professor Joh Reif ALG 1.3 Determiistic Selectio ad Sortig: (a) Selectio Algorithms ad Lower Bouds (b) Sortig Algorithms ad Lower Bouds Problem P size fi divide ito subproblems size 1,..., k

More information

THE ASYMPTOTIC COMPLEXITY OF MATRIX REDUCTION OVER FINITE FIELDS

THE ASYMPTOTIC COMPLEXITY OF MATRIX REDUCTION OVER FINITE FIELDS THE ASYMPTOTIC COMPLEXITY OF MATRIX REDUCTION OVER FINITE FIELDS DEMETRES CHRISTOFIDES Abstract. Cosider a ivertible matrix over some field. The Gauss-Jorda elimiatio reduces this matrix to the idetity

More information

2. ALGORITHM ANALYSIS

2. ALGORITHM ANALYSIS 2. ALGORITHM ANALYSIS computatioal tractability survey of commo ruig times 2. ALGORITHM ANALYSIS computatioal tractability survey of commo ruig times Lecture slides by Kevi Waye Copyright 2005 Pearso-Addiso

More information

6 Integers Modulo n. integer k can be written as k = qn + r, with q,r, 0 r b. So any integer.

6 Integers Modulo n. integer k can be written as k = qn + r, with q,r, 0 r b. So any integer. 6 Itegers Modulo I Example 2.3(e), we have defied the cogruece of two itegers a,b with respect to a modulus. Let us recall that a b (mod ) meas a b. We have proved that cogruece is a equivalece relatio

More information

CALCULATION OF FIBONACCI VECTORS

CALCULATION OF FIBONACCI VECTORS CALCULATION OF FIBONACCI VECTORS Stuart D. Aderso Departmet of Physics, Ithaca College 953 Daby Road, Ithaca NY 14850, USA email: saderso@ithaca.edu ad Dai Novak Departmet of Mathematics, Ithaca College

More information

A Probabilistic Analysis of Quicksort

A Probabilistic Analysis of Quicksort A Probabilistic Aalysis of Quicsort You are assumed to be familiar with Quicsort. I each iteratio this sortig algorithm chooses a pivot ad the, by performig comparisios with the pivot, splits the remaider

More information

Examples: data compression, path-finding, game-playing, scheduling, bin packing

Examples: data compression, path-finding, game-playing, scheduling, bin packing Algorithms - Basic Cocepts Algorithms so what is a algorithm, ayway? The dictioary defiitio: A algorithm is a well-defied computatioal procedure that takes iput ad produces output. This class will deal

More information

Math 475, Problem Set #12: Answers

Math 475, Problem Set #12: Answers Math 475, Problem Set #12: Aswers A. Chapter 8, problem 12, parts (b) ad (d). (b) S # (, 2) = 2 2, sice, from amog the 2 ways of puttig elemets ito 2 distiguishable boxes, exactly 2 of them result i oe

More information

Lecture 3: Asymptotic Analysis + Recurrences

Lecture 3: Asymptotic Analysis + Recurrences Lecture 3: Asymptotic Aalysis + Recurreces Data Structures ad Algorithms CSE 373 SU 18 BEN JONES 1 Warmup Write a model ad fid Big-O for (it i = 0; i < ; i++) { for (it j = 0; j < i; j++) { System.out.pritl(

More information

CSI 2101 Discrete Structures Winter Homework Assignment #4 (100 points, weight 5%) Due: Thursday, April 5, at 1:00pm (in lecture)

CSI 2101 Discrete Structures Winter Homework Assignment #4 (100 points, weight 5%) Due: Thursday, April 5, at 1:00pm (in lecture) CSI 101 Discrete Structures Witer 01 Prof. Lucia Moura Uiversity of Ottawa Homework Assigmet #4 (100 poits, weight %) Due: Thursday, April, at 1:00pm (i lecture) Program verificatio, Recurrece Relatios

More information

NUMERICAL METHODS FOR SOLVING EQUATIONS

NUMERICAL METHODS FOR SOLVING EQUATIONS Mathematics Revisio Guides Numerical Methods for Solvig Equatios Page 1 of 11 M.K. HOME TUITION Mathematics Revisio Guides Level: GCSE Higher Tier NUMERICAL METHODS FOR SOLVING EQUATIONS Versio:. Date:

More information

UNIVERSITY OF NORTHERN COLORADO MATHEMATICS CONTEST. First Round For all Colorado Students Grades 7-12 November 3, 2007

UNIVERSITY OF NORTHERN COLORADO MATHEMATICS CONTEST. First Round For all Colorado Students Grades 7-12 November 3, 2007 UNIVERSITY OF NORTHERN COLORADO MATHEMATICS CONTEST First Roud For all Colorado Studets Grades 7- November, 7 The positive itegers are,,, 4, 5, 6, 7, 8, 9,,,,. The Pythagorea Theorem says that a + b =

More information

Carleton College, Winter 2017 Math 121, Practice Final Prof. Jones. Note: the exam will have a section of true-false questions, like the one below.

Carleton College, Winter 2017 Math 121, Practice Final Prof. Jones. Note: the exam will have a section of true-false questions, like the one below. Carleto College, Witer 207 Math 2, Practice Fial Prof. Joes Note: the exam will have a sectio of true-false questios, like the oe below.. True or False. Briefly explai your aswer. A icorrectly justified

More information

Complex Analysis Spring 2001 Homework I Solution

Complex Analysis Spring 2001 Homework I Solution Complex Aalysis Sprig 2001 Homework I Solutio 1. Coway, Chapter 1, sectio 3, problem 3. Describe the set of poits satisfyig the equatio z a z + a = 2c, where c > 0 ad a R. To begi, we see from the triagle

More information

Inverse Matrix. A meaning that matrix B is an inverse of matrix A.

Inverse Matrix. A meaning that matrix B is an inverse of matrix A. Iverse Matrix Two square matrices A ad B of dimesios are called iverses to oe aother if the followig holds, AB BA I (11) The otio is dual but we ofte write 1 B A meaig that matrix B is a iverse of matrix

More information

THE SOLUTION OF NONLINEAR EQUATIONS f( x ) = 0.

THE SOLUTION OF NONLINEAR EQUATIONS f( x ) = 0. THE SOLUTION OF NONLINEAR EQUATIONS f( ) = 0. Noliear Equatio Solvers Bracketig. Graphical. Aalytical Ope Methods Bisectio False Positio (Regula-Falsi) Fied poit iteratio Newto Raphso Secat The root of

More information

Skip lists: A randomized dictionary

Skip lists: A randomized dictionary Discrete Math for Bioiformatics WS 11/12:, by A. Bocmayr/K. Reiert, 31. Otober 2011, 09:53 3001 Sip lists: A radomized dictioary The expositio is based o the followig sources, which are all recommeded

More information

Properties and Tests of Zeros of Polynomial Functions

Properties and Tests of Zeros of Polynomial Functions Properties ad Tests of Zeros of Polyomial Fuctios The Remaider ad Factor Theorems: Sythetic divisio ca be used to fid the values of polyomials i a sometimes easier way tha substitutio. This is show by

More information

Quantum Computing Lecture 7. Quantum Factoring

Quantum Computing Lecture 7. Quantum Factoring Quatum Computig Lecture 7 Quatum Factorig Maris Ozols Quatum factorig A polyomial time quatum algorithm for factorig umbers was published by Peter Shor i 1994. Polyomial time meas that the umber of gates

More information

ROLL CUTTING PROBLEMS UNDER STOCHASTIC DEMAND

ROLL CUTTING PROBLEMS UNDER STOCHASTIC DEMAND Pacific-Asia Joural of Mathematics, Volume 5, No., Jauary-Jue 20 ROLL CUTTING PROBLEMS UNDER STOCHASTIC DEMAND SHAKEEL JAVAID, Z. H. BAKHSHI & M. M. KHALID ABSTRACT: I this paper, the roll cuttig problem

More information

DATA STRUCTURES I, II, III, AND IV

DATA STRUCTURES I, II, III, AND IV Data structures DATA STRUCTURES I, II, III, AND IV I. Amortized Aalysis II. Biary ad Biomial Heaps III. Fiboacci Heaps IV. Uio Fid Static problems. Give a iput, produce a output. Ex. Sortig, FFT, edit

More information