Algorithms and OOD (CSC 207 2014S) : EBoards

CSC207.01 2014S, Class 48: Dynamic Programming


Overview

Preliminaries

Admin

Upcoming Work

Extra Credit

Questions

The stamps problem

Question: How do you solve this?

Greed is Good

EM

UM

Fibonacci

Why do we care? (other than that it's cooly recursive)

Direct translation

    public static BigInteger fib(int n)
    {
      if (n < 2)
        return new BigInteger(n);
      else
        return fib(n-1).add(fib(n-2));
    } // fib(int)

The stamps problem, revisited

Cache and build from bottom up

Reminder:

Running time: O(t*n) - Essentially linear.

Edit distance in strings

Nope, we didn't get this far.

Copyright (c) 2013-14 Samuel A. Rebelsky.

Creative Commons License

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.