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 ?