Find big theta of summation

1.3k Views Asked by At

The original algorithm is as follows

T $\gets$ new balanced binary search tree
for $i\gets 1$ to $n$ do
$~~~~$ insert ary[i] into T
for i $\gets$ 1 to log(n) do
$~~~~$ extract the largest element from T

I know insertion into T will be $\theta(log(i))$

I know $$\sum_{i=1}^{n} i = \frac{n(n+1)}{2}.$$ Does that mean $$\sum_{i=1}^{n} \log(i) = \frac{\log(n)(\log(n)+1)}{2}?$$ I then can say big theta is $\theta(\log(n))$?

1

There are 1 best solutions below

0
On

No, that would be an incorrect statement; however, from the properties of logarithms, you can say $$\sum_{i=1}^n\log(i)=\log(n!).$$ Now you could apply Stirling's Formula for $n!$ to get an asymptotic.