Recurrence Applications
119 words
1 min read
Visual companion
Python
Type and operator map
Python Week 1: the first filter for runtime behavior
View
Revision summary
What this note is really saying
Short form
# Recurrence Applications ## Tower of Hanoi Number of moves $T_n = 2T_{n-1} + 1$, $T_1 = 1$. Solution: $T_n = 2^n - 1$.

Recurrence Applications
Tower of Hanoi
Number of moves Tn=2Tn−1+1, T1=1.
Solution: Tn=2n−1.
For n=64 disks: 264−1≈1.84×1019 moves — about 585 billion years!
Divide-and-Conquer Recurrence
T(n)=aT(n/b)+f(n)
Master Theorem:
- If f(n)=O(nlogba−ϵ), then T(n)=Θ(nlogba)
- If f(n)=Θ(nlogba), then T(n)=Θ(nlogbalogn)
- If f(n)=Ω(nlogba+ϵ) and af(n/b)≤cf(n), then T(n)=Θ(f(n)) Example: Merge sort: T(n)=2T(n/2)+n. nlog22=n=f(n), so T(n)=Θ(nlogn). Join Discord PreviousRecurrence RelationsNextGenerating Functions