SUNY Geneseo Department of Computer Science


Lower Bounds

{Date}

CSci 141, Fall 2003
Prof. Doug Baldwin

Return to List of Lectures

Previous Lecture


Misc

Learning center closes for Thanksgiving starting Tuesday

Questions?

Optimality

Lower bound (on solution time)

Recall the Towers of Hanoi puzzle

Algorithm to move n disks from pole "source" to pole "dest", via pole "spare"

    solve( n, source, dest, spare )
        if n > 0
            solve( n-1, source, spare, dest )
            move 1 disk from source to dest
            solve( n-1, spare, dest, source )

This runs in Theta(2n) time

Can you find a faster algorithm?

How could you answer this rigorously?

["Black Box" Algorithm for Solving Towers of Hanoi]

What can you deduce the algorithm must do, given rules of puzzle

Has to move all n disks

Rule: large disks can't be on small

Bottom disk has to move at least once

Other n-1 disks must be off source pole and stacked in tower on 3rd pole

How did the n-1 disks get into tower on 3rd pole?

There must some best algorithm for moving towers

Black box algorithm can't be better than best algorithm, can't use fewer moves to move n-1 disk tower than best algorithm would use

Let B(n) be the number of moves the the best algorithm uses to move an n disk tower

Black box algorithm must use at least B(n-1) moves to move n-1 disks to 3rd pole

So black box algorithm uses at least

After biggest disk moves to destination for the last time, an n-1 disk tower has to move onto its top

So black box algorithm uses at least

This reasoning applies to the best algorithm

Closed form

B(n) >= 2n - 1

Mini-assignment: prove above closed form

Next

Read Section 16.3 (open problems)


Next Lecture