GATE | Sudo GATE 2020 Mock III (24 January 2019) | Question 49

What is the time complexity of following function fun()? Assume that log(x) returns log value in base 2.

void fun() 
   int i, j; 
   for (i=1; i<=n; i++) 
      for (j=1; j<=log(i); j++) 

(A) Θ(n)
(B) Θ(n log log n)
(C) Θ(n log n)
(D) Θ(n^2)

Answer: (C)

Explanation: Option (C) Θ(n log n) is correct.

Please refer - A Time Complexity Question

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.

Please write to us at to report any issue with the above content.