I want to find lower and upper bound to complexity of this algorithm
1: for all i=1 to n*n do
2: for all j=i to 2*i do
3: output “hello world”
4: end for
5: end for
By writing it down as summation and simplifying it to
f(n) = 0.5*n^4 + 1.5*n^2
It seems that the upper bound to complexity is O(n^4), since 0.5*n^4 is the most significant element.
For lower bound to complexity, I used the formula
f(n) = Ω(g(n)) if f(n) >= c * g(n), where c > 0
and it seems the lower bound is Ω(n^3) for 0 < c < 1
Is my reasoning correct for both cases? Is there an easier way to find Omega? Thank you for your time :)