Big O notation for two series

83 Views Asked by At

I'm having trouble understanding how to analyze these two series for their Big O representations.

I can get the correct answer for this series

$1+2+3+4+...+N$ is $O(N^2)$, which I found by finding the Big O for the equation $N(N+1)/2$.

Apparently the correct answer for the following question is $O(N)$, but my result obviously differs substantially.

$1+5+25+125+...+N$ is $O(5^N)$

I figured that since the series equation is just $(5^N-1)/4$, I can just find the Big O for that equation, which would be $O(5^N)$

Where is my understanding here flawed?

1

There are 1 best solutions below

3
On BEST ANSWER

Note that the last element in your sum is $N$ rather than $5^N$. So, writing $N=5^k$, the sum is $1+5+\cdots+5^k$, which is $O\left(5^k\right)$ as you wrote; but $5^k=N$, so the sum is $O(N)$.