I have the following loop and wanted to understand the time complexity ...
for i = 1; i <= n; i++
for j = 1; j <= n; j++
j = j * i
}
}
I have the following loop and wanted to understand the time complexity ...
for i = 1; i <= n; i++
for j = 1; j <= n; j++
j = j * i
}
}
These for loops will run infinitely as j = j * i will always return 0 value for j when i=0.
If you are initializing i=1 then the complexity of these two loops will be O(n2) as explained in other comments/answers as it is nested loop.
Inner Loop results in "stack overflow"
j value will always be 0 as it is multiplied by i whose value is 0.
So complexity will be O(INFINITY) .
If i is initialized from 1 i.e i=1 then it would result in some output whose complexity will be O(NlogN)