The Gateway to Computer Science Excellence
0 votes
46 views
what is the time complexity for this code
 

for(i=1; i<=n ; i++){

      for(j=1; j<=log(i) ; j++){

          //Do something

           }

}
in Algorithms by (467 points) | 46 views
+1

i=1 ===> j loop runs log (1) times

i=2 ===> j loop runs log (2) times

i=3 ===> j loop runs log (3) times

......

i=n ===> j loop runs log (n) times

Total time runs = log(1) + log(2) + ....+ log(n) = log (1.2.3.4.....n) = log (n!) = log(nn) = n.log(n)

+1
O(nlogn) ?
0
Thank you for the explanation!

Please log in or register to answer this question.

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,291 answers
198,211 comments
104,903 users