My teacher is writing this on the board (something to do with recursive). Aside: T(n/5)…
- User
My teacher is writing this on the board (something to do with recursive).
Aside: T(n/5) = 5T(n/5^2) + c
She wrote this down after looking at this: T(n) = 5T(n/5) + c, T(1) = c^1
If I'm given something like T(n) = 3T(n/3) + c, T(1) = c^1, how would I solve it?
- Assistant
To solve a recurrence relation like T(n) = 3T(n/3) + c, T(1) = c^1, you can utilize the method of iteration. The idea is to repeatedly substitute for T(n) until a pattern emerges that allows you to generalize the solution for any n that is a power of 3. Here, we assume n = 3^k, where k is a non-negative integer.
Given: T(n) = 3T(n/3) + c, with T(1) = c.
Let's solve step by step:
Step 1: First Iteration
Substitute n = 3^k to get: T(3^k) = 3T(3^(k-1)) + c