html5-img
1 / 12

Recurrence Relations

Recurrence Relations. Useful Facts. Arithmetic series More generally, if a n = a n-1 +c, where c is a constant, then. Useful Facts. Geometric series More generally, if a n = ca n-1 ,where c≠1 is a constant, then If 0< c< 1, then the sum of the infinite geometric series is. Useful Facts.

blaine
Télécharger la présentation

Recurrence Relations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Recurrence Relations

  2. Useful Facts • Arithmetic series • More generally, if an= an-1 +c, where c is a constant, then

  3. Useful Facts • Geometric series • More generally, if an= can-1 ,where c≠1 is a constant, then • If 0< c< 1, then the sum of the infinite geometric series is

  4. Useful Facts • Sum of squares • Harmonic series • γ=0.577..is Euler’s constant

  5. Useful Facts • Basic rules involving logarithms • Sum of logarithms

  6. Useful Facts • Bounding a summation by an integral • If f(x) is a monotonically increasing continuous function, then • Stirling’s approximation • In particular, Stirling’s approximation implies that log2(n!)=Θ(nlogn)

  7. Divide and Conquer Relations • In a divide-and-conquer algorithm, the problem is divided into smaller subproblems, each subproblem is solved recursively, and a combine algorithm is used to solve the original problem. Assume that there are a subproblems, each of size 1/b of the original problem, and that the algorithm used to combine the solutions of the subproblems runs in time cnk, for some constants a,b,c,and k. The running time T(n) of the algorithm thus satisfies

  8. Master Theorem • The solution of the recurrence relation ,where a and b are integer constants, a≥1, b≥2, and c and k are positive constants, is

  9. Proof of Master Theorem(1/4) • We assume, for simplicity, that n=bm, so that n/b is always an integer (b is an integer greater than 1). We first try to expand a couple times to get the feel of it: • In general, if we expand all the way to n/bm =1, we get

  10. Proof of Master Theorem(2/4) • Let’s assume that T(1)=c (a different value would change the end result by only a constant). Then, which implies that But, this is a simple geometric series. There are three cases, depending on whether (bk/a) is less than, greater than, or equal to 1.

  11. Proof of Master Theorem(3/4) • Case 1: a>bk In this case, the factor of the geometric series is less than 1, so the series converges to a constant even if m goes to infinity. Therefore, . Since m=logbn , we get .Thus, • Case 2: a=bk • Case 3: a<bk

  12. Proof of Master Theorem(4/4) • Case 2: a=bk The factor of the geometric series is 1, and thus T(n)=O(amm). Notice that a=bk implies that logba = k and m=O(logn). Thus, • Case 3: a<bk The factor of the geometric series is greater than 1. We use the standard expression for summing a geometric series. Denote bk/a by F (F is a constant). Since the first element of the series is am, we obtain

More Related