5. Solving recurrences
|
|
- Clemence Marylou Atkins
- 5 years ago
- Views:
Transcription
1 5. Solvig recurreces
2 Time Complexity Alysis of Merge Sort T( ) 0 if 1 2T ( / 2) otherwise sortig oth hlves mergig Q. How to prove tht the ru-time of merge sort is O( )? A. 2
3 Time Complexity Alysis of Merge Sort T( ) 0 if 1 2T ( / 2) otherwise sortig oth hlves mergig Q. How to prove tht the ru-time of merge sort is O( )? A. We hve see severl methods: Recursio tree Sustitutio (y iductio) 3
4 Proof y Recursio Tree T( ) 0 if 1 2T ( / 2) otherwise sortig oth hlves mergig #odes(merge time): T() T(/2) T(/2) 2(/2) T(/4) T(/4) T( / 2 k ) T(/4) T(/4) 2 4(/4)... 2 k ( / 2 k )... T(2 ) T(2 ) T(2 ) T(2) T(2 ) T(2 ) T(2 ) T(2 ) T(1) T(1) T(1) T(1) T(1) T(1) T(1) T(1) T(1) T(1) T(1) T(1) T(1) T(1) T(1) T(1) /2 (2) merge time: 2
5 Proof y Iductio/Sustitutio (whe is power of 2) Clim. If T() stisfies this recurrece, the T() = 2. T( ) 0 if 1 2T ( / 2) otherwise sortig oth hlves mergig ssume is power of 2 Pf. (y iductio o ) 5
6 Proof y Iductio/Sustitutio (whe is power of 2) Clim. If T() stisfies this recurrece, the T() = 2. T( ) 0 if 1 2T ( / 2) otherwise sortig oth hlves mergig ssume is power of 2 Pf. (y iductio o ) Bse cse: = 1. Iductio hypothesis: T() = 2. Step: show tht T(2) = 2 2 (2). Q. How do we proof this step? Now for 2 (ot +1 s we re used to)! 6
7 Proof y Iductio/Sustitutio (whe is power of 2) Clim. If T() stisfies this recurrece, the T() = 2. T( ) 0 if 1 2T ( / 2) otherwise sortig oth hlves mergig ssume is power of 2 Pf. (y iductio o ) Bse cse: = 1. Iductio hypothesis: T() = 2. Step: show tht T(2) = 2 2 (2). Now for 2 (ot +1 s we re used to)! T (2 ) 2T ( ) (2 ) Iductio hypothesis 7
8 Proof y Iductio/Sustitutio (whe is power of 2) Clim. If T() stisfies this recurrece, the T() = 2. T( ) 0 if 1 2T ( / 2) otherwise sortig oth hlves mergig ssume is power of 2 Pf. (y iductio o ) Bse cse: = 1. Iductio hypothesis: T() = 2. Step: show tht T(2) = 2 2 (2). Now for 2 (ot +1 s we re used to)! T (2) 2T () (2) (2) (2) 8
9 Proof y Iductio/Sustitutio (with roudig) Clim. If T() stisfies the followig recurrece, the T(). T( ) 0 if 1 T / 2 T / 2 mergig solve left hlf solve right hlf otherwise 2 Pf. (y iductio o ) Bse cse: = 1. Defie 1 = / 2, 2 = / 2. Hypothesis: ssume true for 1, 2,..., 1. Step: 9
10 Proof y Iductio/Sustitutio (with roudig) Clim. If T() stisfies the followig recurrece, the T(). T( ) 0 if 1 T / 2 T / 2 mergig solve left hlf solve right hlf otherwise 2 Pf. (cotiued) Step: T ( ) T ( 1 ) T ( 2 ) Iductio hypothesis 10
11 Proof y Iductio/Sustitutio (with roudig) Clim. If T() stisfies the followig recurrece, the T(). T( ) 0 if 1 T / 2 mergig solve left hlf solve right hlf T / 2 otherwise 2 Pf. (cotiued) Step: T ( ) T ( 1 ) T ( 2 )
12 Proof y Iductio/Sustitutio (with roudig) Clim. If T() stisfies the followig recurrece, the T(). T( ) 0 if 1 T / 2 mergig solve left hlf solve right hlf T / 2 otherwise 2 Pf. (cotiued) Step: T ( ) T ( 1 ) T ( 2 ) ( 1 ) 1 /2 2 / 2 2 / Becuse right side is iteger, roudig to erest iteger is OK. 12
13 Time Complexity Alysis of Merge Sort T( ) 0 if 1 2T ( / 2) otherwise sortig oth hlves mergig Q. How to prove tht the ru-time of merge sort is O( )? A. We hve see severl methods: Recursio tree Sustitutio (y iductio) 13
14 Time Complexity Alysis of Merge Sort T( ) 0 if 1 2T ( / 2) otherwise sortig oth hlves mergig Q. How to prove tht the ru-time of merge sort is O( )? A. We hve see severl methods: Recursio tree Sustitutio (y iductio) We do t like proofs. C t you give us geerl rule for the complexity of recursive fuctios? 14
15 Geerl Recursio Tree for 1, 1, T( ) (1) if 1 T ( /) f ( ) otherwise recursive clls comiig 15
16 Geerl Recursio Tree for 1, 1, T( ) (1) if 1 T ( /) f ( ) otherwise recursive clls comiig #odes(time): T() f() T(/) T(/) T(/) f(/) 16
17 -1+ Geerl Recursio Tree for 1, 1, T( ) (1) if 1 T ( /) f ( ) otherwise recursive clls comiig #odescomiig: T() f() T(/) T(/) T(/) f(/) T(/ 2 ) T(/ 2 ) T( / k ) T(/ 2 ) T(/ 2 ) 2 f(/ 2 )... k f( / k )... T(1) T(1) T(1) T(1) T(1) T(1 ) opertios i the leves T(1) T(1) 1 k 0 k f(1) f k
18 Mster Method for 1, 1, T( ) (1) if 1 T ( /) f ( ) otherwise recursive clls comiig So, T ( ) 1 k 0 where first term is cost of ll suprolems of size 1, d secod term cost for comiig i ech level. k f k Three commo cses: Ruig time domited y cost t leves Ruig time evely distriuted throughout the tree Ruig time domited y cost t root Cosequetly, to solve the recurrece, we eed oly to chrcterize the domit term, or f () 18
19 Mster Method Give recurrece of the form T( ) T ( /) f () We c distiguish three commo cses: 1. Ruig time domited y cost t leves: if f ( ) O the T ( ) for ε > 0 2. Ruig time evely distriuted throughout the tree: if f ( ) the T ( ) 3. Ruig time domited y cost t root: if f ( ) the T ( ) f ( ) for ε > 0 If f() stisfies regulrity coditio: f(/) c f() for some c < 1 (polyomils lwys do) The mster method cot solve every recurrece of this form. 19
20 Summry Mster Method Extrct,, d f() from give recurrece Determie Compre f() d symptoticlly Determie pproprite Mster Method cse d pply: 1. Ruig time domited y cost t leves: if f ( ) O the T ( ) for ε > 0 2. Ruig time evely distriuted throughout the tree: if f ( ) the T ( ) 3. Ruig time domited y cost t root: if f ( ) the T ( ) f ( ) for ε > 0 Cse 3: Oly If f() stisfies regulrity coditio: f(/) c f() for some c < 1 (polyomils lwys do) 20
21 Exmples Extrct,, d f() from give recurrece Determie Compre f() d symptoticlly Determie pproprite Mster Method cse, d pply Exmple. Alyze Merge Sort usig the Mster Method: T ( ) 2T ( / 2) ( ) 2, 2; 2 2 Q. Wht is domit? (leves, equl, root ode) 21
22 Exmples Extrct,, d f() from give recurrece Determie Compre f() d symptoticlly Determie pproprite Mster Method cse, d pply Exmple. Alyze Merge Sort usig the Mster Method: T ( ) 2T ( / 2) ( ) 2, f ( ) 2; ( ) this is cse 2, T ( ) 2 2 f ( ), so 22
23 Exmples Biry-serch(A, p, r, s): q(p+r)/2 if A[q]=s the retur q else if A[q]>s the Biry-serch(A, p, q-1, s) else Biry-serch(A, q+1, r, s) Q. Alyze complexity of iry serch usig the mster method (1 mi) A. Alysis: T ( ) T ( / 2) 1 23
24 Exmples Biry-serch(A, p, r, s): q(p+r)/2 if A[q]=s the retur q else if A[q]>s the Biry-serch(A, p, q-1, s) else Biry-serch(A, q+1, r, s) Q. Alyze complexity of iry serch usig the mster method (1 mi) A. Alysis: T ( ) T ( / 2) 1 1, 2; f ( ) (1) This is cse 2, T ( ) 2 1 f ( ), so: 0 (1) 24
25 Exmples Q. Use the mster method to solve the followig recurrece reltio: T ( ) 9T ( / 3) A. Alysis: 9, 3; f ( ) ( ) Q. Wht is domit? (leves, equl, root ode) 25
26 Exmples Q. Use the mster method to solve the followig recurrece reltio: T ( ) A. Alysis: 9, f ( ) This is cse 1, 9T ( / 3) 3; ( ) T ( ) f () O 2, so: 26
27 Exmples Q. Use the mster method to solve the followig recurrece reltio: T ( ) 3T ( / 4) A. Alysis: 3, 4; f ( ) ( ) Q. Wht is domit? (leves, equl, root ode) 27
28 Exmples Q. Use the mster method to solve the followig recurrece reltio: T ( ) 3T ( / 4) A. Alysis: 3, f ( ) This is cse 3, 4; ( ) 4 3 f () 0.793, so: f ( ) T ( ) WARNING: is ot polyomil Check regulrity coditio. Check regulrity coditio: f ( / ) 3( / 4) ( / 4) (3 / 4) cf ( ) OK, for exmple for c=3/4 (d this c < 1) 28
29 Exmples Q. Use the mster method to solve the followig recurrece reltio: T ( ) 2T ( / 2) A. Alysis: 2, 2; 2 2 f ( ) ( ) Q. Wht is domit? (leves, equl, root ode) 29
30 Exmples Q. Use the mster method to solve the followig recurrece reltio: T ( ) 2T ( / 2) A. Alysis: 2, f ( ) 2; ( ) 2 2 I ll e ck! This is ot cse 3, f (), for c>0, or oe of the others! Bck to sustitutio method d iductio proof (try 2 ). Becuse c for c>0 is ( ), so 1+c is ( ) so is ot ( 1+c ) 30
31 Exmples Q. Use the mster method to solve the followig recurrece reltio: T ( ) 4T ( / 2) 3 A. Alysis: 4, 2; f ( ) ( 3 ) Q. Wht is domit? (leves, equl, root ode) 31
32 Exmples Q. Use the mster method to solve the followig recurrece reltio: T ( ) 4T ( / 2) 3 A. Alysis: 4, 2; f ( ) This is cse 3, ( Check regulrity coditio: 3 ) f () 3 f ( ) T ( ) f ( / ), so: 3 3 / 2 (4 / 8) cf ( ) OK, for exmple for c=3/4 (d this c < 1) 4 32
Similar 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 informationMerge Sort. Outline and Reading. Divide-and-Conquer. Divide-and-conquer paradigm ( 4.1.1) Merge-sort ( 4.1.1)
Merge Sort 7 2 9 4 2 4 7 9 7 2 2 7 9 4 4 9 7 7 2 2 9 9 4 4 Merge Sort versio 1.3 1 Outlie d Redig Divide-d-coquer prdigm ( 4.1.1 Merge-sort ( 4.1.1 Algorithm Mergig two sorted sequeces Merge-sort tree
More informationSection IV.6: The Master Method and Applications
Sectio IV.6: The Mster Method d Applictios Defiitio IV.6.1: A fuctio f is symptoticlly positive if d oly if there exists rel umer such tht f(x) > for ll x >. A cosequece of this defiitio is tht fuctio
More informationLecture 4 Recursive Algorithm Analysis. Merge Sort Solving Recurrences The Master Theorem
Lecture 4 Recursive Algorithm Alysis Merge Sort Solvig Recurreces The Mster Theorem Merge Sort MergeSortA, left, right) { if left < right) { mid = floorleft + right) / 2); MergeSortA, left, mid); MergeSortA,
More informationLecture 4 Recursive Algorithm Analysis. Merge Sort Solving Recurrences The Master Theorem
Lecture 4 Recursive Algorithm Alysis Merge Sort Solvig Recurreces The Mster Theorem Merge Sort MergeSortA, left, right) { if left < right) { mid floorleft right) / 2); MergeSortA, left, mid); MergeSortA,
More informationPresentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, Divide-and-Conquer
Presettio for use with the textook, Algorithm Desig d Applictios, y M. T. Goodrich d R. Tmssi, Wiley, 25 Divide-d-Coquer Divide-d-Coquer Divide-d coquer is geerl lgorithm desig prdigm: Divide: divide the
More informationThis 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 informationRecurrece reltio & Recursio 9 Chpter 3 Recurrece reltio & Recursio Recurrece reltio : A recurrece is equtio or iequlity tht describes fuctio i term of itself with its smller iputs. T T The problem of size
More informationPROGRESSIONS AND SERIES
PROGRESSIONS AND SERIES A sequece is lso clled progressio. We ow study three importt types of sequeces: () The Arithmetic Progressio, () The Geometric Progressio, () The Hrmoic Progressio. Arithmetic Progressio.
More informationData Structures and Algorithms CMPSC 465
Dt Structures nd Algorithms CMPSC 465 LECTURE 10 Solving recurrences Mster theorem Adm Smith S. Rskhodnikov nd A. Smith; bsed on slides by E. Demine nd C. Leiserson Review questions Guess the solution
More informationA GENERAL METHOD FOR SOLVING ORDINARY DIFFERENTIAL EQUATIONS: THE FROBENIUS (OR SERIES) METHOD
Diol Bgoo () A GENERAL METHOD FOR SOLVING ORDINARY DIFFERENTIAL EQUATIONS: THE FROBENIUS (OR SERIES) METHOD I. Itroductio The first seprtio of vribles (see pplictios to Newto s equtios) is ver useful method
More informationRelation of BSTs to Quicksort, Analysis of Random BST. Lecture 9
Reltio o BSTs to Quicsort, Alysis o Rdom BST Lecture 9 Biry-serch-tree sort T Crete empty BST or i = to do TREE-INSERT(T, A[i]) Perorm iorder tree wl o T. Emple: 3 A = [3 8 2 6 7 5] 8 Tree-wl time = O(),
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 informationCS 331 Design and Analysis of Algorithms. -- Divide and Conquer. Dr. Daisy Tang
CS 33 Desig d Alysis of Algorithms -- Divide d Coquer Dr. Disy Tg Divide-Ad-Coquer Geerl ide: Divide problem ito subproblems of the sme id; solve subproblems usig the sme pproh, d ombie prtil solutios,
More informationChapter 7 Infinite Series
MA Ifiite Series Asst.Prof.Dr.Supree Liswdi Chpter 7 Ifiite Series Sectio 7. Sequece A sequece c be thought of s list of umbers writte i defiite order:,,...,,... 2 The umber is clled the first term, 2
More information1.3 Continuous Functions and Riemann Sums
mth riem sums, prt 0 Cotiuous Fuctios d Riem Sums I Exmple we sw tht lim Lower() = lim Upper() for the fuctio!! f (x) = + x o [0, ] This is o ccidet It is exmple of the followig theorem THEOREM Let f be
More informationReview of Sections
Review of Sectios.-.6 Mrch 24, 204 Abstrct This is the set of otes tht reviews the mi ides from Chpter coverig sequeces d series. The specific sectios tht we covered re s follows:.: Sequces..2: Series,
More informationSUTCLIFFE S NOTES: CALCULUS 2 SWOKOWSKI S CHAPTER 11
SUTCLIFFE S NOTES: CALCULUS SWOKOWSKI S CHAPTER Ifiite Series.5 Altertig Series d Absolute Covergece Next, let us cosider series with both positive d egtive terms. The simplest d most useful is ltertig
More informationNumbers (Part I) -- Solutions
Ley College -- For AMATYC SML Mth Competitio Cochig Sessios v.., [/7/00] sme s /6/009 versio, with presettio improvemets Numbers Prt I) -- Solutios. The equtio b c 008 hs solutio i which, b, c re distict
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 informationDiscrete Mathematics I Tutorial 12
Discrete Mthemtics I Tutoril Refer to Chpter 4., 4., 4.4. For ech of these sequeces fid recurrece reltio stisfied by this sequece. (The swers re ot uique becuse there re ifiitely my differet recurrece
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 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( a n ) converges or diverges.
Chpter Ifiite Series Pge of Sectio E Rtio Test Chpter : Ifiite Series By the ed of this sectio you will be ble to uderstd the proof of the rtio test test series for covergece by pplyig the rtio test pprecite
More informationInfinite Series Sequences: terms nth term Listing Terms of a Sequence 2 n recursively defined n+1 Pattern Recognition for Sequences Ex:
Ifiite Series Sequeces: A sequece i defied s fuctio whose domi is the set of positive itegers. Usully it s esier to deote sequece i subscript form rther th fuctio ottio.,, 3, re the terms of the sequece
More informationSequence and Series of Functions
6 Sequece d Series of Fuctios 6. Sequece of Fuctios 6.. Poitwise Covergece d Uiform Covergece Let J be itervl i R. Defiitio 6. For ech N, suppose fuctio f : J R is give. The we sy tht sequece (f ) of fuctios
More informationSection 6.3: Geometric Sequences
40 Chpter 6 Sectio 6.: Geometric Sequeces My jobs offer ul cost-of-livig icrese to keep slries cosistet with ifltio. Suppose, for exmple, recet college grdute fids positio s sles mger erig ul slry of $6,000.
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 information0 otherwise. sin( nx)sin( kx) 0 otherwise. cos( nx) sin( kx) dx 0 for all integers n, k.
. Computtio of Fourier Series I this sectio, we compute the Fourier coefficiets, f ( x) cos( x) b si( x) d b, i the Fourier series To do this, we eed the followig result o the orthogolity of the trigoometric
More informationUnit 1. Extending the Number System. 2 Jordan School District
Uit Etedig the Number System Jord School District Uit Cluster (N.RN. & N.RN.): Etedig Properties of Epoets Cluster : Etedig properties of epoets.. Defie rtiol epoets d eted the properties of iteger epoets
More informationFig. 1. I a. V ag I c. I n. V cg. Z n Z Y. I b. V bg
ymmetricl Compoets equece impedces Although the followig focuses o lods, the results pply eqully well to lies, or lies d lods. Red these otes together with sectios.6 d.9 of text. Cosider the -coected lced
More informationSurds, Indices, and Logarithms Radical
MAT 6 Surds, Idices, d Logrithms Rdicl Defiitio of the Rdicl For ll rel, y > 0, d ll itegers > 0, y if d oly if y where is the ide is the rdicl is the rdicd. Surds A umber which c be epressed s frctio
More informationb a 2 ((g(x))2 (f(x)) 2 dx
Clc II Fll 005 MATH Nme: T3 Istructios: Write swers to problems o seprte pper. You my NOT use clcultors or y electroic devices or otes of y kid. Ech st rred problem is extr credit d ech is worth 5 poits.
More informationDivide-and-Conquer. Divide-and-Conquer 1
Divide-d-Coquer 7 9 4 4 7 9 7 7 9 4 4 9 7 7 9 9 4 4 Divide-d-Coquer 1 Outie d Redig Divide-d-coquer prdigm 5. Review Merge-sort 4.1.1 Recurrece Equtios 5..1 tertive sustitutio Recursio trees Guess-d-test
More informationMathematical Foundation. CSE 6331 Algorithms Steve Lai
Mathematical Foudatio CSE 6331 Algorithms Steve Lai Complexity of Algorithms Aalysis of algorithm: to predict the ruig time required by a algorithm. Elemetary operatios: arithmetic & boolea operatios:
More informationDynamic Programming. Sequence Of Decisions
Dyamic Programmig Sequece of decisios. Problem state. Priciple of optimality. Dyamic Programmig Recurrece Equatios. Solutio of recurrece equatios. Sequece Of Decisios As i the greedy method, the solutio
More informationDynamic Programming. Sequence Of Decisions. 0/1 Knapsack Problem. Sequence Of Decisions
Dyamic Programmig Sequece Of Decisios Sequece of decisios. Problem state. Priciple of optimality. Dyamic Programmig Recurrece Equatios. Solutio of recurrece equatios. As i the greedy method, the solutio
More informationSM2H. Unit 2 Polynomials, Exponents, Radicals & Complex Numbers Notes. 3.1 Number Theory
SMH Uit Polyomils, Epoets, Rdicls & Comple Numbers Notes.1 Number Theory .1 Addig, Subtrctig, d Multiplyig Polyomils Notes Moomil: A epressio tht is umber, vrible, or umbers d vribles multiplied together.
More information8.3 Sequences & Series: Convergence & Divergence
8.3 Sequeces & Series: Covergece & Divergece A sequece is simply list of thigs geerted by rule More formlly, sequece is fuctio whose domi is the set of positive itegers, or turl umbers,,,3,. The rge of
More informationAlgorithm Design and Analysis
Algorithm Design nd Anlysis LECTURE 12 Solving Recurrences Mster Theorem Adm Smith Review Question: Exponentition Problem: Compute b, where b N is n bits long. Question: How mny multiplictions? Nive lgorithm:
More informationNotes 17 Sturm-Liouville Theory
ECE 638 Fll 017 Dvid R. Jckso Notes 17 Sturm-Liouville Theory Notes re from D. R. Wilto, Dept. of ECE 1 Secod-Order Lier Differetil Equtios (SOLDE) A SOLDE hs the form d y dy 0 1 p ( x) + p ( x) + p (
More informationn 2 + 3n + 1 4n = n2 + 3n + 1 n n 2 = n + 1
Ifiite Series Some Tests for Divergece d Covergece Divergece Test: If lim u or if the limit does ot exist, the series diverget. + 3 + 4 + 3 EXAMPLE: Show tht the series diverges. = u = + 3 + 4 + 3 + 3
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 informationMerge 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 informationIntroduction to Algorithms 6.046J/18.401J
Itrodutio to Algorithms.04J/8.40J The divide-d-oquer desig prdigm. Divide the problem (iste) ito subproblems.. Coquer the subproblems by solvig them reursively. 3. Combie subproblem solutios. Leture 3
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 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 informationThe limit comparison test
Roerto s Notes o Ifiite Series Chpter : Covergece tests Sectio 4 The limit compriso test Wht you eed to kow lredy: Bsics of series d direct compriso test. Wht you c ler here: Aother compriso test tht does
More informationAdvanced Algorithmic Problem Solving Le 6 Math and Search
Advced Algorithmic Prolem Solvig Le Mth d Serch Fredrik Heitz Dept of Computer d Iformtio Sciece Liköpig Uiversity Outlie Arithmetic (l. d.) Solvig lier equtio systems (l. d.) Chiese remider theorem (l.5
More informationBasic Limit Theorems
Bsic Limit Theorems The very "cle" proof of L9 usig L8 ws provided to me by Joh Gci d it ws this result which ispired me to write up these otes. Absolute Vlue Properties: For rel umbers x, d y x x if x
More information[ 20 ] 1. Inequality exists only between two real numbers (not complex numbers). 2. If a be any real number then one and only one of there hold.
[ 0 ]. Iequlity eists oly betwee two rel umbers (ot comple umbers).. If be y rel umber the oe d oly oe of there hold.. If, b 0 the b 0, b 0.. (i) b if b 0 (ii) (iii) (iv) b if b b if either b or b b if
More informationUNIVERSITY OF BRISTOL. Examination for the Degrees of B.Sc. and M.Sci. (Level C/4) ANALYSIS 1B, SOLUTIONS MATH (Paper Code MATH-10006)
UNIVERSITY OF BRISTOL Exmitio for the Degrees of B.Sc. d M.Sci. (Level C/4) ANALYSIS B, SOLUTIONS MATH 6 (Pper Code MATH-6) My/Jue 25, hours 3 miutes This pper cotis two sectios, A d B. Plese use seprte
More informationThe total number of permutations of S is n!. We denote the set of all permutations of S by
DETERMINNTS. DEFINITIONS Def: Let S {,,, } e the set of itegers from to, rrged i scedig order. rerrgemet jjj j of the elemets of S is clled permuttio of S. S. The totl umer of permuttios of S is!. We deote
More informationConvergence rates of approximate sums of Riemann integrals
Covergece rtes of pproximte sums of Riem itegrls Hiroyuki Tski Grdute School of Pure d Applied Sciece, Uiversity of Tsuku Tsuku Irki 5-857 Jp tski@mth.tsuku.c.jp Keywords : covergece rte; Riem sum; Riem
More informationLaws of Integral Indices
A Lws of Itegrl Idices A. Positive Itegrl Idices I, is clled the se, is clled the idex lso clled the expoet. mes times.... Exmple Simplify 5 6 c Solutio 8 5 6 c 6 Exmple Simplify Solutio The results i
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 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 informationCS473-Algorithms I. Lecture 3. Solving Recurrences. Cevdet Aykanat - Bilkent University Computer Engineering Department
CS473-Algorthms I Lecture 3 Solvg Recurreces Cevdet Aykt - Blket Uversty Computer Egeerg Deprtmet Solvg Recurreces The lyss of merge sort Lecture requred us to solve recurrece. Recurreces re lke solvg
More informationTaylor Polynomials. The Tangent Line. (a, f (a)) and has the same slope as the curve y = f (x) at that point. It is the best
Tylor Polyomils Let f () = e d let p() = 1 + + 1 + 1 6 3 Without usig clcultor, evlute f (1) d p(1) Ok, I m still witig With little effort it is possible to evlute p(1) = 1 + 1 + 1 (144) + 6 1 (178) =
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 informationMTH 146 Class 16 Notes
MTH 46 Clss 6 Notes 0.4- Cotiued Motivtio: We ow cosider the rc legth of polr curve. Suppose we wish to fid the legth of polr curve curve i terms of prmetric equtios s: r f where b. We c view the cos si
More information) 2 2(2. Assume that
lg lg W W W W W W W Assume tht lg log. 0. with for, W W W For ot power of, W 0 W W W for hrd to lyze this cse exctly ecuse of the floors d ceiligs. usig iductio rgumet lie the oe i Ex B.5 i Appedix B,
More information10.5 Power Series. In this section, we are going to start talking about power series. A power series is a series of the form
0.5 Power Series I the lst three sectios, we ve spet most of tht time tlkig bout how to determie if series is coverget or ot. Now it is time to strt lookig t some specific kids of series d we will evetully
More informationData 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 informationICS141: Discrete Mathematics for Computer Science I
ICS4: Discrete Mthemtics for Computer Sciece I Dept. Iformtio & Computer Sci., J Stelovsky sed o slides y Dr. Bek d Dr. Still Origils y Dr. M. P. Frk d Dr. J.L. Gross Provided y McGrw-Hill 3- Quiz. gcd(84,96).
More informationSequences, 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 informationMATH 118 HW 7 KELLY DOUGAN, ANDREW KOMAR, MARIA SIMBIRSKY, BRANDEN LASKE
MATH 118 HW 7 KELLY DOUGAN, ANDREW KOMAR, MARIA SIMBIRSKY, BRANDEN LASKE Prt 1. Let be odd rime d let Z such tht gcd(, 1. Show tht if is qudrtic residue mod, the is qudrtic residue mod for y ositive iteger.
More informationSchrödinger Equation Via Laplace-Beltrami Operator
IOSR Jourl of Mthemtics (IOSR-JM) e-issn: 78-578, p-issn: 39-765X. Volume 3, Issue 6 Ver. III (Nov. - Dec. 7), PP 9-95 www.iosrjourls.org Schrödiger Equtio Vi Lplce-Beltrmi Opertor Esi İ Eskitşçioğlu,
More informationLinford 1. Kyle Linford. Math 211. Honors Project. Theorems to Analyze: Theorem 2.4 The Limit of a Function Involving a Radical (A4)
Liford 1 Kyle Liford Mth 211 Hoors Project Theorems to Alyze: Theorem 2.4 The Limit of Fuctio Ivolvig Rdicl (A4) Theorem 2.8 The Squeeze Theorem (A5) Theorem 2.9 The Limit of Si(x)/x = 1 (p. 85) Theorem
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 informationSect Simplifying Radical Expressions. We can use our properties of exponents to establish two properties of radicals: and
128 Sect 10.3 - Simplifyig Rdicl Expressios Cocept #1 Multiplictio d Divisio Properties of Rdicls We c use our properties of expoets to estlish two properties of rdicls: () 1/ 1/ 1/ & ( Multiplictio d
More informationCalculus II Homework: The Integral Test and Estimation of Sums Page 1
Clculus II Homework: The Itegrl Test d Estimtio of Sums Pge Questios Emple (The p series) Get upper d lower bouds o the sum for the p series i= /ip with p = 2 if the th prtil sum is used to estimte the
More informationApproximations of Definite Integrals
Approximtios of Defiite Itegrls So fr we hve relied o tiderivtives to evlute res uder curves, work doe by vrible force, volumes of revolutio, etc. More precisely, wheever we hve hd to evlute defiite itegrl
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 informationClosed Newton-Cotes Integration
Closed Newto-Cotes Itegrtio Jmes Keeslig This documet will discuss Newto-Cotes Itegrtio. Other methods of umericl itegrtio will be discussed i other posts. The other methods will iclude the Trpezoidl Rule,
More informationRADICALS. Upon completion, you should be able to. define the principal root of numbers. simplify radicals
RADICALS m 1 RADICALS Upo completio, you should be ble to defie the pricipl root of umbers simplify rdicls perform dditio, subtrctio, multiplictio, d divisio of rdicls Mthemtics Divisio, IMSP, UPLB Defiitio:
More informationRemarks: (a) The Dirac delta is the function zero on the domain R {0}.
Sectio Objective(s): The Dirc s Delt. Mi Properties. Applictios. The Impulse Respose Fuctio. 4.4.. The Dirc Delt. 4.4. Geerlized Sources Defiitio 4.4.. The Dirc delt geerlized fuctio is the limit δ(t)
More informationMATH 104 FINAL SOLUTIONS. 1. (2 points each) Mark each of the following as True or False. No justification is required. y n = x 1 + x x n n
MATH 04 FINAL SOLUTIONS. ( poits ech) Mrk ech of the followig s True or Flse. No justifictio is required. ) A ubouded sequece c hve o Cuchy subsequece. Flse b) A ifiite uio of Dedekid cuts is Dedekid cut.
More informationLecture 38 (Trapped Particles) Physics Spring 2018 Douglas Fields
Lecture 38 (Trpped Prticles) Physics 6-01 Sprig 018 Dougls Fields Free Prticle Solutio Schrödiger s Wve Equtio i 1D If motio is restricted to oe-dimesio, the del opertor just becomes the prtil derivtive
More informationB. Examples 1. Finite Sums finite sums are an example of Riemann Sums in which each subinterval has the same length and the same x i
Mth 06 Clculus Sec. 5.: The Defiite Itegrl I. Riem Sums A. Def : Give y=f(x):. Let f e defied o closed itervl[,].. Prtitio [,] ito suitervls[x (i-),x i ] of legth Δx i = x i -x (i-). Let P deote the prtitio
More informationf(t)dt 2δ f(x) f(t)dt 0 and b f(t)dt = 0 gives F (b) = 0. Since F is increasing, this means that
Uiversity of Illiois t Ur-Chmpig Fll 6 Mth 444 Group E3 Itegrtio : correctio of the exercises.. ( Assume tht f : [, ] R is cotiuous fuctio such tht f(x for ll x (,, d f(tdt =. Show tht f(x = for ll x [,
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 informationCanonical Form and Separability of PPT States on Multiple Quantum Spaces
Coicl Form d Seprbility of PPT Sttes o Multiple Qutum Spces Xio-Hog Wg d Sho-Mig Fei, 2 rxiv:qut-ph/050445v 20 Apr 2005 Deprtmet of Mthemtics, Cpitl Norml Uiversity, Beijig, Chi 2 Istitute of Applied Mthemtics,
More informationConvergence rates of approximate sums of Riemann integrals
Jourl of Approximtio Theory 6 (9 477 49 www.elsevier.com/locte/jt Covergece rtes of pproximte sums of Riem itegrls Hiroyuki Tski Grdute School of Pure d Applied Sciece, Uiversity of Tsukub, Tsukub Ibrki
More informationGeneral properties of definite integrals
Roerto s Notes o Itegrl Clculus Chpter 4: Defiite itegrls d the FTC Sectio Geerl properties of defiite itegrls Wht you eed to kow lredy: Wht defiite Riem itegrl is. Wht you c ler here: Some key properties
More informationWeek 13 Notes: 1) Riemann Sum. Aim: Compute Area Under a Graph. Suppose we want to find out the area of a graph, like the one on the right:
Week 1 Notes: 1) Riem Sum Aim: Compute Are Uder Grph Suppose we wt to fid out the re of grph, like the oe o the right: We wt to kow the re of the red re. Here re some wys to pproximte the re: We cut the
More informationWe will begin by supplying the proof to (a).
(The solutios of problem re mostly from Jeffrey Mudrock s HWs) Problem 1. There re three sttemet from Exmple 5.4 i the textbook for which we will supply proofs. The sttemets re the followig: () The spce
More informationThe Exponential Function
The Epoetil Fuctio Defiitio: A epoetil fuctio with bse is defied s P for some costt P where 0 d. The most frequetly used bse for epoetil fuctio is the fmous umber e.788... E.: It hs bee foud tht oyge cosumptio
More informationlecture 16: Introduction to Least Squares Approximation
97 lecture 16: Itroductio to Lest Squres Approximtio.4 Lest squres pproximtio The miimx criterio is ituitive objective for pproximtig fuctio. However, i my cses it is more ppelig (for both computtio d
More informationORIE 633 Network Flows September 27, Lecture 8
ORIE 633 Network Flows September 7, 007 Lecturer: David P. Williamso Lecture 8 Scribe: Gema Plaza-Martíez 1 Global mi-cuts i udirected graphs 1.1 Radom cotractio Recall from last time we itroduced the
More informationUNIT 4 EXTENDING THE NUMBER SYSTEM Lesson 1: Working with the Number System Instruction
Lesso : Workig with the Nuber Syste Istructio Prerequisite Skills This lesso requires the use of the followig skills: evlutig expressios usig the order of opertios evlutig expoetil expressios ivolvig iteger
More informationChapter 5. The Riemann Integral. 5.1 The Riemann integral Partitions and lower and upper integrals. Note: 1.5 lectures
Chpter 5 The Riem Itegrl 5.1 The Riem itegrl Note: 1.5 lectures We ow get to the fudmetl cocept of itegrtio. There is ofte cofusio mog studets of clculus betwee itegrl d tiderivtive. The itegrl is (iformlly)
More informationLimit of a function:
- Limit of fuctio: We sy tht f ( ) eists d is equl with (rel) umer L if f( ) gets s close s we wt to L if is close eough to (This defiitio c e geerlized for L y syig tht f( ) ecomes s lrge (or s lrge egtive
More informationCH 39 USING THE GCF TO REDUCE FRACTIONS
359 CH 39 USING THE GCF TO EDUCE FACTIONS educig Algeric Frctios M ost of us lered to reduce rithmetic frctio dividig the top d the ottom of the frctio the sme (o-zero) umer. For exmple, 30 30 5 75 75
More informationRepeated Root and Common Root
Repeted Root d Commo Root 1 (Method 1) Let α, β, γ e the roots of p(x) x + x + 0 (1) The α + β + γ 0, αβ + βγ + γα, αβγ - () (α - β) (α + β) - αβ (α + β) [ (βγ + γα)] + [(α + β) + γ (α + β)] +γ (α + β)
More informationName: A2RCC Midterm Review Unit 1: Functions and Relations Know your parent functions!
Nme: ARCC Midterm Review Uit 1: Fuctios d Reltios Kow your pret fuctios! 1. The ccompyig grph shows the mout of rdio-ctivity over time. Defiitio of fuctio. Defiitio of 1-1. Which digrm represets oe-to-oe
More information10.5 Test Info. Test may change slightly.
0.5 Test Ifo Test my chge slightly. Short swer (0 questios 6 poits ech) o Must choose your ow test o Tests my oly be used oce o Tests/types you re resposible for: Geometric (kow sum) Telescopig (kow sum)
More informationis an ordered list of numbers. Each number in a sequence is a term of a sequence. n-1 term
Mthemticl Ptters. Arithmetic Sequeces. Arithmetic Series. To idetify mthemticl ptters foud sequece. To use formul to fid the th term of sequece. To defie, idetify, d pply rithmetic sequeces. To defie rithmetic
More information{ } { S n } is monotonically decreasing if Sn
Sequece A sequece is fuctio whose domi of defiitio is the set of turl umers. Or it c lso e defied s ordered set. Nottio: A ifiite sequece is deoted s { } S or { S : N } or { S, S, S,...} or simply s {
More information