Help finding Complexity in Big-O notation

pandrade
Messages
4
Reaction score
0

Homework Statement



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 proved that it's bounded by [tex]n^3[/tex]or [tex]n^4[/tex] ? Thank you!

Homework Equations



[tex]\sum_{j=3}^{n} \left[(j-1)[2(j-2)-1] + \sum_{i=2}^{j-2}(i) + <br /> \sum_{k=2}^{j-2}\left[k(j-(k+1))+\sum_{i=k}^{j-2}(i)\right]\right][/tex]

The Attempt at a Solution



I run 1000 numbers and apparently it is bounded by [tex]n^3[/tex].
 
Last edited by a moderator:
on Phys.org
First simplification step:
[tex]\sum_{j=3}^{n} \left[O(n)O(n) + O(n^2) + <br /> \sum_{k=2}^{j-2}\left[k(j-(k+1))+\sum_{i=k}^{j-2}(i)\right]\right][/tex]
To get O(n^3) I think you have to evaluate the innermost sum to cancel some parts of the k(j-(k+1)), but apart from that (or for an O(n^4)-boundary) you can always estimate those terms as bounded by n, with rules like O(n)O(n)=O(n^2) and so on.
 
I see.
To be honest I would like to get a [tex]n^3[/tex] :-), but I see what you are saying.
I have plotted it against [tex]n^3[/tex] for [tex]n[/tex] from 1 to 10,000 and I guess I got carried away because it seemed to be asymptotically bounded, but of course, there's no guarantee, at all.
I will try to open the sum and see if it cancels out, as you suggested, if not, I'll consider [tex]n^4[/tex].
Thank you so much!
 
I don't think this is O(n^3).
I would expect O(n^4), and this is easy to show.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 26 ·
Replies
26
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 21 ·
Replies
21
Views
2K