Hello! Codeforces. Today I had created a recursion relation but I am unable to solve this to find the time complexity of the algorithm.
Recursion Relation
Please help me to solve this.
# | User | Rating |
---|---|---|
1 | jiangly | 3860 |
2 | Benq | 3783 |
3 | maroonrk | 3627 |
4 | fantasy | 3526 |
5 | ko_osaga | 3500 |
6 | Um_nik | 3496 |
7 | tourist | 3487 |
8 | inaFSTream | 3477 |
9 | Radewoosh | 3437 |
10 | zh0ukangyang | 3423 |
# | User | Contrib. |
---|---|---|
1 | Um_nik | 185 |
2 | awoo | 182 |
3 | nor | 172 |
4 | -is-this-fft- | 170 |
5 | adamant | 169 |
6 | maroonrk | 165 |
7 | antontrygubO_o | 160 |
8 | SecondThread | 158 |
9 | dario2994 | 151 |
9 | kostka | 151 |
Hello! Codeforces. Today I had created a recursion relation but I am unable to solve this to find the time complexity of the algorithm.
T(n) = √n * T(√n) + n lg (√n)
Please help me to solve this.
Name |
---|
Here is a similar recursion relation : https://www.quora.com/What-is-time-complexity-for-T-n-%E2%88%9An-T-%E2%88%9An-+-%E2%88%9An Solve yours by the same method
Sorry in advance, I don't know how to use latex :(
T(n) = sqrt(n) * T(sqrt(n)) + n * log(sqrt(n))
T(n) = sqrt(n) * T(sqrt(n)) + n * log(n) / 2
n = 2^k
T(2^k) = sqrt(2^k) * T(sqrt(2^k)) + 2^k * log(2^k) / 2
T(2^k) = 2^(k / 2) * T(2^(k / 2)) + 2^(k-1) * k
divide both sides by 2^k
T(2^k) / 2^k = T(2^(k / 2)) / 2^(k / 2) + k / 2
let y(k) = T(2^k) / 2^k
y(k) = y(k / 2) + k / 2
y(k) = k
T(2^k) / 2^k = y(k)
T(2^k) = 2^k * y(k)
T(2^k) = 2^k * k
T(n) = n * log(n)
y(k) = y(k / 2) + k / 2
y(k) = k
Can you explain how you got this?
It's obvious that y(k) = k / 2 + k / 4 + k / 8 + k / 16 + ...
Using formula for sum of geometric series, you can get that y(k) = k
Oh! yeah. Thanks for the solving this.