SUNY Geneseo Department of Computer Science


Introduction to Recurrence Relations

{Date}

CSci 141, Spring 2005
Prof. Doug Baldwin

Return to List of Lectures

Previous Lecture


Misc

Next week I'm out of town Wednesday through Friday, Prof. Zollo gives lectures

Questions?

Recurrence Relations

Section 7.2.1

Recurrence relations

Induction to prove recurrence relations

Closed forms = non-recursive expressions that produce same value as a recurrence

Examples

Introductory example

n f(n)
0 2
1 5+2
2 5+5+2

Another...

Connection to Algorithms

How many primitive Robot messages does this send while painting an n-tile line?

    // In some subclass of Robot...
    paintLine( n )
        if n > 1
            this.paint( red )
            this.move()
            this.paintLine( n-1 )
        else
            this.paint( red )

Let p(n) = number of primitive messages sent, as function of n

Read Section 7.2.2


Next Lecture