Recurrences: Methods and Examples
|
|
- Neal Pierce
- 5 years ago
- Views:
Transcription
1 Reurrees: Methods ad Examples CSE 30 Algorithms ad Data Strutures Alexadra Stefa Uiversity of exas at Arligto Updated: 308
2 Summatios Review Review slides o Summatios
3 Reurrees Reursive algorithms It may ot be lear what the omplexity is, by just lookig at the algorithm. I order to fid their omplexity, we eed to: Express the ruig time of the algorithm as a reurree formula. E.g.: f = + f- Fid the omplexity of the reurree: Expad it to a summatio with o reursive term. Fid a oise expressio or upper boud, E, for the summatio. Fid Θ,ideally, or O big-oh for E. Reurree formulas may be eoutered i other situatios: Compute the umber of odes i ertai trees. Express the omplexity of o-reursive algorithms e.g. seletio sort. 3
4 Commo Reurrees Loal ost Θ Θ 3 Θ 4 Θ 5 Θ Number of subproblems Size of subproblem Desriptio Example - Redue the pb size by i ost time. - Redue the pb size by i liear time. Halve problem i ost time Halve problem i liear time Break ad put bak together the problem ito halves i ost time. 6 Θ Break ad put bak together the problem ito halves i liear time. 4
5 Solvig Reurrees he Master heorem he Reursio-ree Method Useful for guessig the boud. I will also aept this method as proof for the give boud if doe orretly. he Idutio Method Guess the boud, use idutio to prove it. Note that the book alls this the substitutio method, but I prefer to all it the idutio method 5
6 he Master Method - ite: CLRS Note that log b a - ε = log b a - ε ad log b a + ε = log b a + ε Solve: lg Not appliable for: See CLRS, page 95, for solutio. lg 6
7 he Master heorem Method , 9 log log log 3 ase O f a b a a b b lg lg 3 0 log log log 3 ase f a b a a b b Note that log b a - ε = log b a - ε ad log b a + ε = log b a + ε
8 he Master heorem Method Note that log b a - ε = log b a - ε ad log b a + ε = log b a + ε 3 4 lg a 3 b 4 log 4 f lg log, 0. ase3 eed : af b f 3 4lg lg lg, true 3 4. Need, b lg lg a 0.8 lg a b 3 log f lg lg B.., 0,lg log b a but ot by O lg O * O 8 => Caot apply the Master theorem
9 Reurrees: Reursio-ree Method. Build the tree & fill-out the table. Compute ost per level 3. Compute umber of levels 4. Compute total over levels. * Fid losed form of that summatio. Example : Solve 3 4 Example : Solve 3 3 O 9
10 N N- ime omplexity tree: N = N- + fatn it fatit N { if N <= retur ; retur N*fatN-; } ime omplexity of fatn? N = N = N- + = 0 = Levels: N Eah ode has ost => N = *N = ΘN 0
11 N = N-4 + N N-4 ime omplexity tree: 4 it fat4it N { if N <= retur ; if N == retur ; if N == 3 retur 6 retur N*N-*N-*N-3*fat4N-; } ime omplexity of fat4n? N = N = N = = = 0 = 0 Levels: N4 Eah ode has ost => N = *N4 = ΘN
12 N N- ime omplexity tree: - N = N- + N seletio_sort_ren it fatit N{ if N <= retur; idx = mi_idexa,st,n; ΘN-st A[st] <-> A[idx] retur sel_sort_rea,st+,n; } N = N- + N = 0 = Levels: N Node at level i has ost N-i => N = N+N-+i+.. = NN+ = ΘN
13 N = N + N ime omplexity tree: N N = N + = 0 = Levels: lgn from base ase: N k = => k=lgn Eah ode has ost => N = *lgn = ΘlgN 3
14 N = N + N N ime omplexity tree: N N N N = N + N = 0 = Levels: lgn from base ase: N k = => k=lgn Node at level i has ost N i => N = N + N + N + N i + + N k = = N i + + k = = N[ + + ½ + ½ i + + ½ k ] = = N*ostat = ΘN 4
15 Reurree - Reursio ree = a* b + Number of subproblems => Number of hildre of a ode i the reursio tree. => Affets the umber of odes per level. At level i there will be a i odes. Affets the level ost. Relatioship he loal ost at the ode b b a b Size of a subproblem => Affets whe the reursio stops the k for whih we get : Last level, k, will be: k = log b assumig the base ase is for. b b 5
16 Reursio ree for: = + 4 Base ase: = Level Arg pb size Nodes per level ode ost Level ost i i i i... Stop at level k, whe the subtree is. => he problem size is, but the geeral formula for the problem size, at level k is: k => k = => k = lg k=lg = k k = k ree ost = i ++ k = k+ - = k = = Θ 6
17 Reursio ree for: = + 4 Base ase: = Stop at level k, whe the subtree is. => he problem size is, but the geeral formula for the problem size, at level k is: k => k = => k = lg Level Arg pb size Nodes per level ode ost Level ost 0 * * * ** =* 4 4 *4 4**4 =* i i i * i i ** i k=lg = k k = =*= * k =* k ** k =* ree ost * k * lg lg lg 7
18 Reursio ree for = Base ase: = Level Arg pb size Nodes per level ode ost 0 * * Level ost 3 * 3** =3** 4 9 *4 3 ** i i 3 i * i 3 i **... Stop at level k, whe the subtree is. => he problem size is, but the geeral formula for the problem size, at level k is: k => k = => k = lg k=lg = k 3 k =*= * k 3 k ** 8
19 otal ree Cost for = 3+ Closed form 3 3 *[ 3 3 lg 3 * 3 use : lg 3* lg lg3 3 [3 *3 lg lg3 lg3 lg i ] lg lg3lg ] 3*3 lg3 lg i 0 lg3 3 lg i lg3 lg Explaatio: sie we eed Θ, we a elimiate the ostats ad odomiat terms earlier after the losed form expressio: lg 3 lg... * *3 *3 *3 3 use : lg * lg lg3 3 lg3 lg lg3 lg3lg lg3 lg 9
20 5 Reursio ree for: = Stop at level k, whe the subtree is. => he problem size is, but the geeral formula for the problem size, at level k is: 5 k => 5 k = => k = log 5 Level Arg pb size Nodes per level ode ost Level ost 0 * * 5 *5 **5 =5* 5 4 *5 4** =5 i i 5 i i *5 i i **5 i k=lg =5 k k = =*= *5 k =5 i k **5 k =5 k ree ost derivatio similar to ost for = 3+ 0
21 otal ree Cost for = i... 5 log 5 *[ 5 5 log 5 i0 5 * i... 5 i0 5 O ] Also... i log 5
22 Other Variatios = 73+ = Here istead of 73 we will use 73 5 = + he tree beomes a hai oly oe ode per level
23 Reursio ree for: = Base ase: = Stop at level k, whe the subtree is. => he problem size is, but the geeral formula for the problem size, at level k is: 5 k => 5 k = => k = log 5 Level Arg pb size Nodes per level ode ost 0 3 * 3 Level ost **5 3 = **5 3 = i 5 i 7 i 5 i 3 7 i **5 i 3 k= log 5 =5 k 7 k =*= 5 k 3 = i 7 k **5 k 3 = k Where we used: 7 i * 5 i 3 = 7 i * 3 5 i 3 = 7 i * i = i
24 ree Method Draw the tree, otie the shape, see legth of shortest ad logest paths. Notie that: as log as the levels are full all odes have hildre the level ost is the sum of osts of the hildre equals the paret: 3*p_ost+3 *p_ost otal ost for those: *log 3 = Θlg he umber of iomplete levels should also be a multiple of lg ad the ost for eah of those levels will be less tha => Guess that = Olg Use the substitutio method to show = Olg If the reurree was give with Θ istead of O, we ould have show = Θlg with O, de oly kow that: 3+3+ he loal ost ould eve be ostat: = Exerise: Solve = 3+ Θ = 3+ Θ useful: lg3.59 Use them to boud. How does that ompare to the aalysis i this slide? he bouds are looser. 3 3 O 4
25 Reurrees: Idutio Method. Guess the solutio. Use idutio to prove it. 3. Chek it at the boudaries reursio base ases Example: Fid upper boud for:. Guess that = Olg =>. Prove that = Olg usig <= lg for some. Assume it holds for all m<, ad prove it holds for. 3. Assume base ase boudary: =. Pik ad 0 s.t. it works for suffiiet base ases ad applyig the idutive hypotheses. 5
26 Reurrees: Idutio Method. Prove that = Olg, usig the defiitio: fid ad 0 s.t. *lg here: f =, g = lg Show with idutio: *lg for some >0 * * *lg lg lg lg : lg * * *lg wat 0 lg 0 lg Pik = the largest of both ad. lg 3. Base ase boudary: Assume = Fid 0 s.t. the idutio holds for all 0. =: = **lg =*0 =0 FALSE. => 0 aot be. =: = * + = +=4 Wat *lg=, rue for: =3: 3=*+3=+3=5 Wat 5=3 *3*lg3 rue for: 6 Pik 0 = 4 s.t. we have 0 whe applyig the idutive hypothesis
27 Reurrees: Idutio Method Various Issues Makig a good guess Solve: 7 Fid a similar reursio Use looser upper ad lower bouds ad gradually tighte them Subtleties stroger oditio eeded with Use a stroger oditio: off by a ostat, subtrat a ostat Avoidig pitfalls Solve: ad 0 = Wrog: I the above example, stop at + ad olude that =O See also book example of wrog proof for is O Chagig variables Reommeded readig, ot required page 86 7
28 Stroger Hypothesis for Show = O usig the defiitio: fid ad 0 s.t. * here: f =, g =. Use idutio to show * Idutive step: assume it holds for all m<, show for : We re stuk. We CANNO say that =O at this poit. We must prove the hypothesis exatly: ot: +. Use a stroger hypothesis: prove that -d, for some ost d>0: 8 0 : d d d wat d d d d d
29 Solve: Use the tree method to make a guess for: Use the idutio method for the origial reurree with roudig dow:
30 Additioal materials 30
31 Commo Reurrees Review. Redue the problem size by i ostat time: = + Θ N. Redue the problem size by i liear time: = - + Θ N 3. Halve problem i ostat time : = + Θ lgn 4. Halve problem i liear time : = + ΘN ~N 5. Break ad put bak together the problem ito halves i ostat time: = + ΘN ~N 6. Break ad put bak together the problem ito halves i liear time: = + Θ N lgn 3
32 PratieStregthe uderstadig Look ito the derivatio if we had: = d. I geeral, at most, it affets the ostat for the domiat term. 3
33 Aswer Look ito the derivatio if we had: = d. At most, it affets the ostat for the domiat term. Level Arg pb size Nodes per level ode ost Level ost 0 * * * ** =* 4 4 *4 4**4 =* i i i * i i ** i =* k=lg = k k = d =d* ree ost k d lg d lg 33
34 Permutatios without repetitios Harder Example Coverig this material is subjet to time availability ime omplexity ree, ituitio for movig the loal ost i the reursive all ost, math justifiatio idutio 34
35 More Reurrees Extra material M. Redue the problem size by i logarithmi time E.g. Chek lgn items, elimiate M. Redue the problem size by i N time E.g. Chek N pairs, elimiate item M3. Algorithm that: takes Θ time to go over N items. alls itself 3 times o data of size N-. takes Θ time to ombie the results. M4. ** Algorithm that: alls itself N times o data of size N. takes Θ time to ombie the results. his geerates a diffiult reursio. 35
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 informationAlgorithms 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 informationAlgorithms. Elementary Sorting. Dong Kyue Kim Hanyang University
Algorithms Elemetary Sortig Dog Kyue Kim Hayag Uiversity dqkim@hayag.a.kr Cotets Sortig problem Elemetary sortig algorithms Isertio sort Merge sort Seletio sort Bubble sort Sortig problem Iput A sequee
More informationClass #25 Wednesday, April 19, 2018
Cla # Wedesday, April 9, 8 PDE: More Heat Equatio with Derivative Boudary Coditios Let s do aother heat equatio problem similar to the previous oe. For this oe, I ll use a square plate (N = ), but I m
More informationCS583 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 informationRecurrence Relations
Recurrece Relatios Aalysis of recursive algorithms, such as: it factorial (it ) { if (==0) retur ; else retur ( * factorial(-)); } Let t be the umber of multiplicatios eeded to calculate factorial(). The
More information4.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 informationCS 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 informationDesign and Analysis of Algorithms
Desig ad Aalysis of Algorithms CSE 53 Lecture 9 Media ad Order Statistics Juzhou Huag, Ph.D. Departmet of Computer Sciece ad Egieerig Dept. CSE, UT Arligto CSE53 Desig ad Aalysis of Algorithms Medias ad
More informationCS 5150/6150: Assignment 1 Due: Sep 23, 2010
CS 5150/6150: Assigmet 1 Due: Sep 23, 2010 Wei Liu September 24, 2010 Q1: (1) Usig master theorem: a = 7, b = 4, f() = O(). Because f() = log b a ε holds whe ε = log b a = log 4 7, we ca apply the first
More informationData 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 informationWRITTEN ASSIGNMENT 1 ANSWER KEY
CISC 65 Itrodutio Desig ad Aalysis of Algorithms WRITTEN ASSIGNMENT ANSWER KEY. Problem -) I geeral, this problem requires f() = some time period be solve for a value. This a be doe for all ase expet lg
More informationCOMP26120: Introducing Complexity Analysis (2018/19) Lucas Cordeiro
COMP60: Itroduig Complexity Aalysis (08/9) Luas Cordeiro luas.ordeiro@mahester.a.uk Itroduig Complexity Aalysis Textbook: Algorithm Desig ad Appliatios, Goodrih, Mihael T. ad Roberto Tamassia (hapter )
More informationCIS 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 informationCS161: 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 informationCS / 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 informationData 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 informationA 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 informationModel 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 informationModel 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ε > 0 N N n N a n < ε. Now notice that a n = a n.
4 Sequees.5. Null sequees..5.. Defiitio. A ull sequee is a sequee (a ) N that overges to 0. Hee, by defiitio of (a ) N overges to 0, a sequee (a ) N is a ull sequee if ad oly if ( ) ε > 0 N N N a < ε..5..
More informationProblem 4: Evaluate ( k ) by negating (actually un-negating) its upper index. Binomial coefficient
Problem 4: Evaluate by egatig actually u-egatig its upper idex We ow that Biomial coefficiet r { where r is a real umber, is a iteger The above defiitio ca be recast i terms of factorials i the commo case
More informationFundamental Algorithms
Fudametal Algorithms Chapter 2b: Recurreces Michael Bader Witer 2014/15 Chapter 2b: Recurreces, Witer 2014/15 1 Recurreces Defiitio A recurrece is a (i-equality that defies (or characterizes a fuctio i
More informationMATH 31B: MIDTERM 2 REVIEW
MATH 3B: MIDTERM REVIEW JOE HUGHES. Evaluate x (x ) (x 3).. Partial Fractios Solutio: The umerator has degree less tha the deomiator, so we ca use partial fractios. Write x (x ) (x 3) = A x + A (x ) +
More informationRADICAL EXPRESSION. If a and x are real numbers and n is a positive integer, then x is an. n th root theorems: Example 1 Simplify
Example 1 Simplify 1.2A Radical Operatios a) 4 2 b) 16 1 2 c) 16 d) 2 e) 8 1 f) 8 What is the relatioship betwee a, b, c? What is the relatioship betwee d, e, f? If x = a, the x = = th root theorems: RADICAL
More informationCSE 5311 Notes 1: Mathematical Preliminaries
Chapter 1 - Algorithms Computig CSE 5311 Notes 1: Mathematical Prelimiaries Last updated 1/20/18 12:56 PM) Relatioship betwee complexity classes, eg log,, log, 2, 2, etc Chapter 2 - Gettig Started Loop
More informationRecursive 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 informationCSI 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 informationCSE 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 informationLecture 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 informationAfter the completion of this section the student. V.4.2. Power Series Solution. V.4.3. The Method of Frobenius. V.4.4. Taylor Series Solution
Chapter V ODE V.4 Power Series Solutio Otober, 8 385 V.4 Power Series Solutio Objetives: After the ompletio of this setio the studet - should reall the power series solutio of a liear ODE with variable
More informationACCESS 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 informationAnalysis 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 informationProperties 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 informationExplicit and closed formed solution of a differential equation. Closed form: since finite algebraic combination of. converges for x x0
Chapter 4 Series Solutios Epliit ad losed formed solutio of a differetial equatio y' y ; y() 3 ( ) ( 5 e ) y Closed form: sie fiite algebrai ombiatio of elemetary futios Series solutio: givig y ( ) as
More informationBernoulli Numbers. n(n+1) = n(n+1)(2n+1) = n(n 1) 2
Beroulli Numbers Beroulli umbers are amed after the great Swiss mathematiia Jaob Beroulli5-705 who used these umbers i the power-sum problem. The power-sum problem is to fid a formula for the sum of the
More informationThe 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 informationCS 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 informationZeros of Polynomials
Math 160 www.timetodare.com 4.5 4.6 Zeros of Polyomials I these sectios we will study polyomials algebraically. Most of our work will be cocered with fidig the solutios of polyomial equatios of ay degree
More information1 Generating functions for balls in boxes
Math 566 Fall 05 Some otes o geeratig fuctios Give a sequece a 0, a, a,..., a,..., a geeratig fuctio some way of represetig the sequece as a fuctio. There are may ways to do this, with the most commo ways
More informationLesson 10: Limits and Continuity
www.scimsacademy.com Lesso 10: Limits ad Cotiuity SCIMS Academy 1 Limit of a fuctio The cocept of limit of a fuctio is cetral to all other cocepts i calculus (like cotiuity, derivative, defiite itegrals
More informationLecture 7: Solving Recurrences
Lecture 7: Solvig Recurreces CSE 7: Data Structures ad Algorithms CSE 7 19 WI KASEY CHAMPION 1 Warm Up Writig Recurreces CSE 7 19 WI KASEY CHAMPION 2 Admiistriva HW 2 Part 1 due Friday git ruers will get
More informationDivide & 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 informationAlgorithms Design & Analysis. Divide & Conquer
Algorithms Desig & Aalysis Divide & Coquer Recap Direct-accessible table Hash tables Hash fuctios Uiversal hashig Perfect Hashig Ope addressig 2 Today s topics The divide-ad-coquer desig paradigm Revised
More informationChapter 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 information6.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 informationMatriculation number: You have 90 minutes to complete the exam of InformatikIIb. The following rules apply:
Departmet of Iformatics Prof. Dr. Michael Böhle Bizmühlestrasse 14 8050 Zurich Phoe: +41 44 635 4333 Email: boehle@ifi.uzh.ch AlgoDat Midterm1 Sprig 016 08.04.016 Name: Matriculatio umber: Advice You have
More informationFall 2018 Exam 2 PIN: 17 INSTRUCTIONS
MARK BOX problem poits 0 0 HAND IN PART 0 3 0 NAME: Solutios 4 0 0 PIN: 6-3x % 00 INSTRUCTIONS This exam comes i two parts. () HAND IN PART. Had i oly this part. () STATEMENT OF MULTIPLE CHOICE PROBLEMS.
More informationMa 530 Introduction to Power Series
Ma 530 Itroductio to Power Series Please ote that there is material o power series at Visual Calculus. Some of this material was used as part of the presetatio of the topics that follow. What is a Power
More informationCSE Introduction to Parallel Processing. Chapter 3. Parallel Algorithm Complexity
Dr. Izadi CSE-40533 Itroductio to Parallel Processig Chapter 3 Parallel Algorithm Complexity Review algorithm complexity ad various complexity classes Itroduce the otios of time ad time-cost optimality
More informationIntroduction to Algorithms 6.046J/18.401J LECTURE 3 Divide and conquer Binary search Powering a number Fibonacci numbers Matrix multiplication
Itroductio to Algorithms 6.046J/8.40J LECTURE 3 Divide ad coquer Biary search Powerig a umber Fiboacci umbers Matrix multiplicatio Strasse s algorithm VLSI tree layout Prof. Charles E. Leiserso The divide-ad-coquer
More informationSECTION 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 informationSolutions 3.2-Page 215
Solutios.-Page Problem Fid the geeral solutios i powers of of the differetial equatios. State the reurree relatios ad the guarateed radius of overgee i eah ase. ) Substitutig,, ad ito the differetial equatio
More informationAnalysis 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 informationMachine Learning Brett Bernstein
Machie Learig Brett Berstei Week 2 Lecture: Cocept Check Exercises Starred problems are optioal. Excess Risk Decompositio 1. Let X = Y = {1, 2,..., 10}, A = {1,..., 10, 11} ad suppose the data distributio
More informationSect Definition of the nth Root
Cocept #1 Sect 11.1 - Defiitio of the th Root Defiitio of a Square Root. The square of a umber is called a perfect square. So, 1,, 9, 16, 2, 0.09, ad 16 2 are perfect squares sice 1 = 12, = 2 2, 9 = 2,
More information3.2 Properties of Division 3.3 Zeros of Polynomials 3.4 Complex and Rational Zeros of Polynomials
Math 60 www.timetodare.com 3. Properties of Divisio 3.3 Zeros of Polyomials 3.4 Complex ad Ratioal Zeros of Polyomials I these sectios we will study polyomials algebraically. Most of our work will be cocered
More informationTHE 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 informationPOWER SERIES METHODS CHAPTER 8 SECTION 8.1 INTRODUCTION AND REVIEW OF POWER SERIES
CHAPTER 8 POWER SERIES METHODS SECTION 8. INTRODUCTION AND REVIEW OF POWER SERIES The power series method osists of substitutig a series y = ito a give differetial equatio i order to determie what the
More information(b) What is the probability that a particle reaches the upper boundary n before the lower boundary m?
MATH 529 The Boudary Problem The drukard s walk (or boudary problem) is oe of the most famous problems i the theory of radom walks. Oe versio of the problem is described as follows: Suppose a particle
More informationClassification 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 informationCOMP26120: More on the Complexity of Recursive Programs (2018/19) Lucas Cordeiro
COMP26120: More o the Complexity of Recursive Programs (2018/19) Lucas Cordeiro lucas.cordeiro@machester.ac.uk Divide-ad-Coquer (Recurrece) Textbook: Algorithm Desig ad Applicatios, Goodrich, Michael T.
More informationSYDE 112, LECTURE 2: Riemann Sums
SYDE, LECTURE : Riema Sums Riema Sums Cosider the problem of determiig the area below the curve f(x) boud betwee two poits a ad b. For simple geometrical fuctios, we ca easily determie this based o ituitio.
More informationPolynomial Functions and Their Graphs
Polyomial Fuctios ad Their Graphs I this sectio we begi the study of fuctios defied by polyomial expressios. Polyomial ad ratioal fuctios are the most commo fuctios used to model data, ad are used extesively
More informationCALCULUS BASIC SUMMER REVIEW
CALCULUS BASIC SUMMER REVIEW NAME rise y y y Slope of a o vertical lie: m ru Poit Slope Equatio: y y m( ) The slope is m ad a poit o your lie is, ). ( y Slope-Itercept Equatio: y m b slope= m y-itercept=
More informationTest 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 informationSimilar idea to multiplication in N, C. Divide and conquer approach provides unexpected improvements. Naïve matrix multiplication
Next. Covered bsics of simple desig techique (Divided-coquer) Ch. of the text.. Next, Strsse s lgorithm. Lter: more desig d coquer lgorithms: MergeSort. Solvig recurreces d the Mster Theorem. Similr ide
More informationMATH 10550, EXAM 3 SOLUTIONS
MATH 155, EXAM 3 SOLUTIONS 1. I fidig a approximate solutio to the equatio x 3 +x 4 = usig Newto s method with iitial approximatio x 1 = 1, what is x? Solutio. Recall that x +1 = x f(x ) f (x ). Hece,
More informationPractice Problems: Taylor and Maclaurin Series
Practice Problems: Taylor ad Maclauri Series Aswers. a) Start by takig derivatives util a patter develops that lets you to write a geeral formula for the -th derivative. Do t simplify as you go, because
More informationCS 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 informationAdvanced 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 information6.046 Recitation 5: Binary Search Trees Bill Thies, Fall 2004 Outline
6.046 Recitatio 5: Biary Search Trees Bill Thies, Fall 2004 Outlie My cotact iformatio: Bill Thies thies@mit.edu Office hours: Sat 1-3pm, 36-153 Recitatio website: http://cag.lcs.mit.edu/~thies/6.046/
More informationIP 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 informationMath 234 Test 1, Tuesday 27 September 2005, 4 pages, 30 points, 75 minutes.
Math 34 Test 1, Tuesday 7 September 5, 4 pages, 3 poits, 75 miutes. The high score was 9 poits out of 3, achieved by two studets. The class average is 3.5 poits out of 3, or 77.5%, which ordiarily would
More informationDigital Signal Processing. Homework 2 Solution. Due Monday 4 October Following the method on page 38, the difference equation
Digital Sigal Proessig Homework Solutio Due Moda 4 Otober 00. Problem.4 Followig the method o page, the differee equatio [] (/4[-] + (/[-] x[-] has oeffiiets a0, a -/4, a /, ad b. For these oeffiiets A(z
More informationCarleton 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 informationMIDTERM 3 CALCULUS 2. Monday, December 3, :15 PM to 6:45 PM. Name PRACTICE EXAM SOLUTIONS
MIDTERM 3 CALCULUS MATH 300 FALL 08 Moday, December 3, 08 5:5 PM to 6:45 PM Name PRACTICE EXAM S Please aswer all of the questios, ad show your work. You must explai your aswers to get credit. You will
More informationRandomized Algorithms I, Spring 2018, Department of Computer Science, University of Helsinki Homework 1: Solutions (Discussed January 25, 2018)
Radomized Algorithms I, Sprig 08, Departmet of Computer Sciece, Uiversity of Helsiki Homework : Solutios Discussed Jauary 5, 08). Exercise.: Cosider the followig balls-ad-bi game. We start with oe black
More informationTennessee Department of Education
Teessee Departmet of Educatio Task: Comparig Shapes Geometry O a piece of graph paper with a coordiate plae, draw three o-colliear poits ad label them A, B, C. (Do ot use the origi as oe of your poits.)
More informationQuadratic Functions. Before we start looking at polynomials, we should know some common terminology.
Quadratic Fuctios I this sectio we begi the study of fuctios defied by polyomial expressios. Polyomial ad ratioal fuctios are the most commo fuctios used to model data, ad are used extesively i mathematical
More informationANSWERS SOLUTIONS iiii i. and 1. Thus, we have. i i i. i, A.
013 ΜΑΘ Natioal Covetio ANSWERS (1) C A A A B (6) B D D A B (11) C D D A A (16) D B A A C (1) D B C B C (6) D C B C C 1. We have SOLUTIONS 1 3 11 61 iiii 131161 i 013 013, C.. The powers of i cycle betwee
More informationStatistics 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 informationMAT1026 Calculus II Basic Convergence Tests for Series
MAT026 Calculus II Basic Covergece Tests for Series Egi MERMUT 202.03.08 Dokuz Eylül Uiversity Faculty of Sciece Departmet of Mathematics İzmir/TURKEY Cotets Mootoe Covergece Theorem 2 2 Series of Real
More informationTHE KENNESAW STATE UNIVERSITY HIGH SCHOOL MATHEMATICS COMPETITION PART II Calculators are NOT permitted Time allowed: 2 hours
THE 06-07 KENNESAW STATE UNIVERSITY HIGH SCHOOL MATHEMATICS COMPETITION PART II Calculators are NOT permitted Time allowed: hours Let x, y, ad A all be positive itegers with x y a) Prove that there are
More informationChapter 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 informationIntroduction to Signals and Systems, Part V: Lecture Summary
EEL33: Discrete-Time Sigals ad Systems Itroductio to Sigals ad Systems, Part V: Lecture Summary Itroductio to Sigals ad Systems, Part V: Lecture Summary So far we have oly looked at examples of o-recursive
More informationMA131 - Analysis 1. Workbook 3 Sequences II
MA3 - Aalysis Workbook 3 Sequeces II Autum 2004 Cotets 2.8 Coverget Sequeces........................ 2.9 Algebra of Limits......................... 2 2.0 Further Useful Results........................
More informationReal Variables II Homework Set #5
Real Variables II Homework Set #5 Name: Due Friday /0 by 4pm (at GOS-4) Istructios: () Attach this page to the frot of your homework assigmet you tur i (or write each problem before your solutio). () Please
More informationSigma notation. 2.1 Introduction
Sigma otatio. Itroductio We use sigma otatio to idicate the summatio process whe we have several (or ifiitely may) terms to add up. You may have see sigma otatio i earlier courses. It is used to idicate
More informationMath 113, Calculus II Winter 2007 Final Exam Solutions
Math, Calculus II Witer 7 Fial Exam Solutios (5 poits) Use the limit defiitio of the defiite itegral ad the sum formulas to compute x x + dx The check your aswer usig the Evaluatio Theorem Solutio: I this
More informationSeptember 2012 C1 Note. C1 Notes (Edexcel) Copyright - For AS, A2 notes and IGCSE / GCSE worksheets 1
September 0 s (Edecel) Copyright www.pgmaths.co.uk - For AS, A otes ad IGCSE / GCSE worksheets September 0 Copyright www.pgmaths.co.uk - For AS, A otes ad IGCSE / GCSE worksheets September 0 Copyright
More informationDepartment 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 informationAP Calculus BC Review Applications of Derivatives (Chapter 4) and f,
AP alculus B Review Applicatios of Derivatives (hapter ) Thigs to Kow ad Be Able to Do Defiitios of the followig i terms of derivatives, ad how to fid them: critical poit, global miima/maima, local (relative)
More informationC. Complex Numbers. x 6x + 2 = 0. This equation was known to have three real roots, given by simple combinations of the expressions
C. Complex Numbers. Complex arithmetic. Most people thik that complex umbers arose from attempts to solve quadratic equatios, but actually it was i coectio with cubic equatios they first appeared. Everyoe
More informationChapter 8 Hypothesis Testing
Chapter 8 for BST 695: Speial Topis i Statistial Theory Kui Zhag, Chapter 8 Hypothesis Testig Setio 8 Itrodutio Defiitio 8 A hypothesis is a statemet about a populatio parameter Defiitio 8 The two omplemetary
More informationSolutions to Tutorial 3 (Week 4)
The Uiversity of Sydey School of Mathematics ad Statistics Solutios to Tutorial Week 4 MATH2962: Real ad Complex Aalysis Advaced Semester 1, 2017 Web Page: http://www.maths.usyd.edu.au/u/ug/im/math2962/
More informationANALYSIS OF EXPERIMENTAL ERRORS
ANALYSIS OF EXPERIMENTAL ERRORS All physical measuremets ecoutered i the verificatio of physics theories ad cocepts are subject to ucertaities that deped o the measurig istrumets used ad the coditios uder
More informationFrequentist Inference
Frequetist Iferece The topics of the ext three sectios are useful applicatios of the Cetral Limit Theorem. Without kowig aythig about the uderlyig distributio of a sequece of radom variables {X i }, for
More informationMathematics review for CSCI 303 Spring Department of Computer Science College of William & Mary Robert Michael Lewis
Mathematics review for CSCI 303 Sprig 019 Departmet of Computer Sciece College of William & Mary Robert Michael Lewis Copyright 018 019 Robert Michael Lewis Versio geerated: 13 : 00 Jauary 17, 019 Cotets
More informationChapter 22. Comparing Two Proportions. Copyright 2010, 2007, 2004 Pearson Education, Inc.
Chapter 22 Comparig Two Proportios Copyright 2010, 2007, 2004 Pearso Educatio, Ic. Comparig Two Proportios Read the first two paragraphs of pg 504. Comparisos betwee two percetages are much more commo
More information