How can we solve this recurrence relation $T(n) = T(n-1)+\frac 1n$
I would like to calculate the time complexity of the algorithm.
How can we solve this recurrence relation $T(n) = T(n-1)+\frac 1n$
I would like to calculate the time complexity of the algorithm.
You can "solve" the recurrence relation to get (assuming $T(1) = 1$) something like
$$ T(n) = 1 + \frac{1}{2} + \frac{1}{3} + \cdots + \frac{1}{n}$$
This is the harmonic series, which is famously very close to $\log_e(n)$.