0 votes 0 votes isn't this fuction is constant? answer should be A no? please corrrect me here... S Ram asked Jan 15, 2017 S Ram 197 views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply Prateek Yadav 2 commented Jan 15, 2017 reply Follow Share let i=0 then j runs from 0 to n for j=0: k runs 0 times j=1:k runs 1 times j=2:k runs 2 times so on hence total number of times k run is 0+1+2+3+4+.......n-1=n(n-1)/2 i.e. O(n2) times so we can say that for every value of i inner loop get executed for O(n2) and i goes from 0 to 100 hence time complexity 100*O(n2) i.e.O(n2) only 1 votes 1 votes santhoshdevulapally commented Jan 15, 2017 reply Follow Share first for loop is constant.O(1) Second for loop executes O(n) time and third for loop is executes O(n-1) times. Total time complexity =O(1)*O(n)*O(n-1) =O($n^{2}$ 2 votes 2 votes Please log in or register to add a comment.