What's the Big O notation of a for loop where i < n^2?
for(int i = 0; i < n*n; i++)
for(int j = 0; j < n*n; j++)
What's the Big O notation of a for loop where i < n^2?
for(int i = 0; i < n*n; i++)
for(int j = 0; j < n*n; j++)
O(n)
no
O(1)
Well,
O(n*n),
I guess.
O(N^4) you retards
O(o)
this
I fucking hate nu/g/
O(:))
O(e^ni)
But it is true, but you just round it to n^2
n refers to the number of elements, not variable names.
What the fuck, of course not. It refers to number of steps aka calculations your algorithm does
Hey a b8 let's bite as hard as I can!!!!!;-)
You see op when u have a 4-loop like that the complexity is actully the number of iterations times the complexity of whats inside
The inner loop has about n^2 iterations (with unknown content rofl) so its O(n^2)
The outer loop is about the same so it has a complexity of n^2 times the first loop so O(n^4) in total
Hope this helps ;-)
...
O(^2)
O(-1+i)
O(:(){ :|: & };:)
It runs in linear time scaling with n^4
kek
But that's the worst case time
What if the program crashes midway?
O(w^o)
O((n*n)^2), which is O(n^4)