1

I need to figure out the complexity of the following loop in theta notation but I can't figure it out. Some help would be much appreciated.

from j := 1 until j > n loop
  from k := 1 until k > n*n*n loop
     k := k + j
  end
j := j + 2
end

some help with an explanation would be much appreciated. The solutions state $\theta(n^3log(n))$. it is clear that the second loop executes $n^3$ times but where does the $log$ come from?

Thanks a lot in advance

Raphael
  • 73,212
  • 30
  • 182
  • 400

0 Answers0