recurrences

18
Recurrences 1

Upload: colorado-rich

Post on 31-Dec-2015

26 views

Category:

Documents


0 download

DESCRIPTION

Recurrences. recurrence. A recurrence is an equation or inequality that describes a function in terms of its value on smaller inputs. Example: MERGE-SORT procedure could be described by the recurrence:. R ecurrence M ethods. Substitution Method, Recursion-tree method, Master method. - PowerPoint PPT Presentation

TRANSCRIPT

1

Recurrences

2

3

recurrence

• A recurrence is an equation or inequality that describes a function in terms of its value on smaller inputs.

• Example:– MERGE-SORT procedure could be described by the

recurrence:

4

Recurrence Methods

• Substitution Method,

• Recursion-tree method,

• Master method

5

The substitution method

• The substitution method for solving recurrences entails two steps:– 1. Guess the form of the solution.– 2. Use mathematical induction to find the

constants and show that the solution works.• The substitution method can be used to

establish either upper or lower bounds on a recurrence.

6

7

As an example, let us determine an upper bound on the recurrence

8

The recursion-tree method

• A recursion tree is best used to generate a good guess, which is then verified by the substitution method.

• Using recursion trees to generate good guesses.

9

10

For example

We start by focusing on finding an upper bound for the solution.

create a recursion tree for the recurrence

we assume that n is an exact power of 4

11

12

13

guess

14

15

The master method

16

17

18

Proof of the master theorem (no need)