0 votes 0 votes time complexity of given function fun(int n){ for(int i = 0;i<n;i++) for(int j=i;j<i*i;j++) if(j%i==0){ for(int k =0;k<j;k++) printf("*"); } } Algorithms algorithms time-complexity + – indrajeet asked Nov 11, 2016 indrajeet 1.3k views answer comment Share Follow See all 6 Comments See all 6 6 Comments reply Show 3 previous comments vijaycs commented Nov 12, 2016 i edited by vijaycs Nov 12, 2016 reply Follow Share ^That is for j loop ( j= i to i ^2). We can also write (i2 - i ) in place of i^2. 0 votes 0 votes Tendua commented Nov 12, 2016 reply Follow Share You have already unrolled loops right and the count submission of i terms. may I ask how you unrolled the loops. ? 0 votes 0 votes vijaycs commented Nov 12, 2016 reply Follow Share ^here j is looping for (i^2- i) times for each i, irrespective of if(j%i ==0). right ?? And 2nd term is for - when if(j%i==0) -> true. 0 votes 0 votes Please log in or register to add a comment.