PAUSE: Can the average cost be worse than the worst cost, or better than the best cost?
Find the average cost (=worst cost) for the Towers of Hanoi.
PAUSE: Show the cost to equal 2n - 1.
Proof by Induction:
In HANOI, we must move every disk but the biggest at least twice and the the biggest at least once so 2n - 1 is a lower bound. But each time we move the biggest disk, we must also move all n-1 disks, so f(n) >= f(n-1) [f is non-decreasing].
PAUSE: Use induction to show that f(n) >= 2n - 1.
Compare n! with 2n and 22n
Write their recurrence functions
PAUSE: Use induction to show that n! >= 22n for n >= 9.
Binomial Theorem and Binomial coefficients
Fibonacci
Find the amount of work done by the code fragment in Figure 1.1 (pg.33)
Summations
PAUSE: Estimate the summation of (ai + b) from 1 to n.
The subtract-and-guess or divide-and-guess strategy: To find the value of the sum f, pick a known function g and find a pattern in the terms f(n) - g(n) or f(n) / g(n)
e.g. to find the summation of i from 1 to n, compare with g(n) where g(n) is summation of 1 from 1 to n and then divide
PAUSE: What is the summation of n2
How fast do the Fibonacci numbers grow?
| f=o(g) | f is slower than g |
| f=O(g) | f is no faster than g |
| f=Q(g) | f is about as fast as g[f=O(g) and g=O(f)] |
| f~g | f is as fast as g |
| f=W(g) | f is no slower than g [g=O(f)] |
| Q(1) | constant |
| Q(lg n) | logarithmic |
| Q(lgc n, c>=1 | polylogarithmic |
| Q(nr)0<r<1 | sublinear |
| Q(n) | linear |
| Q(nr1<r<2) | subquadratic |
| Q(n2) | quadratic |
| Q(n3) | cubic |
| Q(nc, c>=1) | polynomial |
| Q(rn, r>1) | exponential |