I have found the complexity of an algorithm as the expression below. How can I find the complexity in big O notation for such expression? Or prove that it's bounded by $n^3$ or $n^4$. Can I use triple integral to approximate? If so, do I have to consider any error (I just want the highest degree of the resulting polynomial)?

I run 10000 numbers and apparently it is bounded by $n^3$ (can't say for sure).

$\sum_{j=3}^{n} \left[(j-1)[2(j-2)-1] + \sum_{i=2}^{j-2}(i) + \sum_{k=2}^{j-2}\left[k(j-(k+1))+\sum_{i=k}^{j-2}(i)\right]\right]$



Using various forms of the key relation $\sum\limits_{s=1}^ts^a=O(t^{a+1})$ when $t\to\infty$, for each $a\geqslant0$, one sees that the $n$th sum $S_n$ is $$ S_n=\sum_{j\leqslant n}j^2+O(j^2)+O(j^3)+jO(j^2)=\sum_{j\leqslant n}O(j^3)=O(n^4). $$

  • $\begingroup$ Thank for the answer! But one question: inside the parenthesis, there is a -$k^2$ (neg.) and a $jk$ (pos.), doesn't it matter? Is it still $O(j^3)$+$jO(j^2)$ (one negative and another positive)? And also $k$ is always bounded by $j$ (lower or equal than j-2). Thanks again! $\endgroup$ – pandrade Jan 25 '13 at 12:52
  • $\begingroup$ Yes, $k(j-(k+1))\leqslant j^2$ and you sum $j-4$ of these hence the result is $\leqslant j^3$. $\endgroup$ – Did Jan 25 '13 at 13:25
  • $\begingroup$ That you! I appreciate it. $\endgroup$ – pandrade Jan 25 '13 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.