Facing problem to determine Time complexity

Revision en1, by code.blood, 2017-07-20 21:53:02

I recently saw at one blog , A code is executed like that

N + N/2 + N/3 + N/4 + ....... + N/N

and author of this code saying

N + N/2 + N/3 + N/4 + ....... + N/N = O(N log(N) ) ? How ?

We know complexity of something is divided by 2 , become log2(N) . For example binary search's worst case complexity is O(log2(N) ) . But how the upper snippet

N + N/2 + N/3 + N/4 + ....... + N/N


equals to O(N log2(N) ) ? Can anyone explain it ?

#### History

Revisions

Rev. Lang. By When Δ Comment
en1 code.blood 2017-07-20 21:53:02 513 Initial revision (published)