I have two questions, which I have trying but unable to figure them out. 1) 𝑇(𝑛) = 𝑇(𝑛 − 1) + 𝑛^4 2) 𝑇(𝑛) = 2𝑇 (𝑛/2) + 𝑛 lg 𝑛
For first one, I am assuming substitution (am I correct?), and got kb + T(n-k). Pretty sure that's wrong so need help with it.
For the second one, I have no idea at all...
Any help would be great! Thanks!
1) So you got
...? I don't know how you obtained this but it's certainly incorrect.
This is basically the summation of the 4th power of all integers up to n
. The standard formula for this is:
2) We can find a pattern if we keep expanding this:
The limit log n - 1
is because we keep dividing the parameter to T
by 2, so the substitution as above can continue for log n
lines until, say T(1)
or wherever the stopping condition is. Continuing using the logarithm rules (google them if you don't know):
Both summations have log n
terms. Since the 1st summation does not depend on i
at all, we simply multiply by log n
. The 2nd summation is given by a standard formula for summation of integers from 1 (or 0, doesn't matter in this case):