Facing problem to determine Time complexity

Правка en1, от 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 ?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский code.blood 2017-07-20 21:53:02 513 Initial revision (published)