开发者

For TimeComplexity analysis ima need help with a Summation

for an algorithm time complexity analysis i开发者_C百科 need to know what is the result of the summation of the function n/i when i runs from 1 to logn, i saw somewhere trustable that is actually the harmonic sum, but i highly doubt it...

the function of the algorithm was originally T(n)=5T(n/5)+n/logn

this question was originally found at the Introduction to algorithms second edition book

save me! :)

http://faculties.sbu.ac.ir/~tahmasbi/DataStructure/Introduction%20to%20Algorithms-Cormen%20Solution.pdf

in page 58,there's a line say:

=n*sigma n/i where i goes from 1 to logn

=n*sigma 1/i where i goes from 1 to logn

thats the only part i have problem with.... cause all they did was taking that n out of the sigma, but where is it gone to? why is it true to just make it disappear?

as opposed to what they're saying i think it should be like:

=n*sigma n/i where i goes from 1 to logn

=n*n*sigma 1/i where i goes from 1 to logn

=n^2*sigma 1/i where i goes from 1 to logn


it is indeed harmonic sum:

n/1 + n/2 + ... + n/logn = n* [ 1 + 1/2 + ... + 1/logn] = n*H(logn) where H(logn) is the logn harmonic number.

the book uses H(m) = theta(logm) and because of this, H(logn) = theta(loglogn). so at overall we get: T(n) = n*H(logn) = n*theta(loglogn) = theta(n*loglogn).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜