# Big O Help

Status
This thread has been Locked and is not open to further replies. The original thread starter may use the Report button to request it be reopened but anyone else with a similar issue should start a New Thread. Watch our Welcome Guide to learn how to use this site.

#### tenniskev18

Hey guys/girls.

I am having issues determining the Big O for this set of loops.

for(int i =0; i < n; i++)
for(int j = 0; j < i*i; j++)
for(int k = 0; k < j; k++)
sum++;

I know that the two outmost loop is O and the middle loop is O(n^2), but I cant quiet determine what the third loops big O is... When I run the code I am getting 162 as the number of iterations.

Also:

for(int i = 1; i < n; i++)
for(int j = 1; j < i*i; j++)
if(j%i == 0)
for(int k = 0; k<j; k++)
sum++;

The outmost loop is n, the middle is n^2, but I cant figure out what the last loops big O is.

Anyone have any suggestions or comments?

Thanks

Status
This thread has been Locked and is not open to further replies. The original thread starter may use the Report button to request it be reopened but anyone else with a similar issue should start a New Thread. Watch our Welcome Guide to learn how to use this site.

As Seen On