0 votes 0 votes i am getting t.c as O(n^5) but given answer as O(n^4) what should be the answer Algorithms time-complexity algorithms asymptotic-notation test-series + – pranab ray asked Jan 13, 2018 • retagged Jul 13, 2022 by makhdoom ghaya pranab ray 423 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes $\sum_{i=1}^{n} \sum_{j=1}^{i^{2}} j/2 = O(n^{5})$ Please suggest accordingly Durgesh Singh answered Jan 16, 2018 Durgesh Singh comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes It think it's O(n4) because i will run n times j will go till n2 but it will be running only n times as from 1 to n2 you will have n cases when j%i will be 0. For eg. say n=12 iteration is going on. n2 is 144. Now from 1 to 144, you will encounter 12 (n) cases like 12,24,36,48,etc. Coming to k, k goes till j and hence can go till n2 as value of j will go till n2 so n*n*n2 = n4 gauravkc answered Jan 16, 2018 gauravkc comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes For i=1 ,j=1,k=1 for i=2 ,j=1 to 4 ,k=2+4=1(1+2) for i=3,j=1 to 9 , k=3+6+9=3(1+2+3) . . .overall summation = 1+2(1+2)+3(1+2+3)+.....+n(1+2+3+....+n) =1.1+2.o(2^2)+3.o(3^2)+.....n.o(n2) =summation of cubic series=o(n^4) HIMANSHU KUMAR 3 answered Jun 14, 2018 HIMANSHU KUMAR 3 comment Share Follow See all 0 reply Please log in or register to add a comment.