Neural Sync Active
Recurrence Applications
Registry Synced
Recurrence Applications
119 words
1 min read
Reading compass
Now · Tower of Hanoi
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