For the below code : foo() { for(i=1;i<=n;i++) { for(j=0;j<i;j++) { for(k=0;k<j;k++) c++; } } } Here k is executing j-1 times and j is executing i times and i is executing n^2 times , so first I am doing summation from k=0 to k=j-1 over k ... 1 to n^2 , I am getting order of n^8 .But this is getting too large , I checked with an example , it is not matching ,So please correct where I went wrong .
asked
Jun 28, 2018
in Algorithms
radha gogia
362 views