The big-theta running time would be Θ(n^4)
.
Big-O is an upper bound, where-as big-theta is a tight bound. What this means is that to say the code is O(n^5)
is also correct (but Θ(n^5)
is not), whatever's inside the big-O just has to be asymptotically bigger than or equal to n^4
.
I'm assuming 5
can be substituted for another value (i.e. is n
), if not, the loop would run in constant time (O(1)
and Θ(1)
), since 5^4
is constant.