Lecture 2: Recurrences
August 22nd, 2007The material for this lecture is drawn largely from Jeff Erickson’s notes on recurrences, linked in Quicklinks to the right. A paper that lays out much of this material is Some Techniques for Solving Recurrences by George Lueker.
You can access this paper directly if you’re inside the utah.edu domain. If not, or if you’re having trouble accessing it, let me know.
The two recurrences I discussed in the class are:
- $latex T(n)=\sqrt{n}T(\sqrt{n})+n $
- $latex T(n) = T(n - \sqrt{n}) + 1$
Probably the most important technique that I omitted to mention was the easiest of them all - GUESS the answer ! This is not as bad a technique as it sounds. Using educated guesses, you can do a crude “binary search” among possibilities. For example, suppose we guessed that the answer to the first recurrence was
$latex T(n)=\Theta(n)=cn$. In that case, we can substitute back and see that
$latex cn = c\sqrt{n} \sqrt{n} + n$
$latex cn = n(1 + c) $
Clearly, this can never be true for any $latex c>0$, and so the guess must be too low. Another guess might be $latex T(n)=cn\log{n}$, which you can back-substitute and verify gives an answer that is too large.
August 22nd, 2007 at 3:07 pm
[...] Lecture 2 links are up, as well as some discussion of perhaps the most important technique for solving recurrences: Guess and verify ! [...]
August 29th, 2007 at 4:59 pm
Is the solution to T(n) = sqrt(n) T(sqrt(n)) + n = O(n log log n) ?
August 29th, 2007 at 8:50 pm
In fact it is !