How to find the recurrence relation T(N) = T(N/2) + N^2 -
what process involved in simplifying recurrence relation?
i able much:
t(n) = t(n/2) + n^2 t(n) = t(n/4) + (n/2)^2 +n^2 t(n) = t(n/8) + (n/4)^2 + (n/2)^2 + n^2
i understand terminate when n = 1 because 1/2 = 0; c(0) = 0. past stuck on way figure out these problems.
well basic idea c(n)
, c(n/2)
should expression of same form. since difference simple function of n
, infinite sum should pop mind, c(n)-c(n/2)
becomes telescopic. each term of sum should given function n/2^k
(for k=0, 1, ...
) argument.
hence c(n) = n^2 + (n/2)^2 + (n/4)^2 + (n/8)^2 + ...
job, , can further evaluated of identities geometric series c(n)=4/3*n^2
.
Comments
Post a Comment