和1 / i的渐近符号

时间:2017-12-16 03:45:15

标签: algorithm time-complexity asymptotic-complexity

渐近符号是什么?

enter image description here

sum_(i = 1)^n (1 / i)

首先,这不是作业。其次,由于没有公式来计算分数,我不知道如何用n表达这个求和并获得渐近符号

可能是Theta(n),但我不确定

1 个答案:

答案 0 :(得分:1)

你的表达

sum_(i = 1)^n (1 / i)

n-th harmonic number

来自维基百科的文章:

  

n-th 谐波次数n自然对数大约相同 。原因是总和近似 积分

     

int_1^n (1 / x) dx

     

,其值为ln(n)

他们还给出了这个显示相关性的漂亮图像:

correlation between harmonic and natural log

所以它是Theta(log n)

有关详细信息,请参阅Finding Big O of the Harmonic SeriesSimple proof of showing the Harmonic number Hn=Θ(logn),这很简单。