PA of Algorithms Q65

  • Option : B
  • Explanation :
    Θ(n3)
    So, this is in Θ(log n)
    Hence Answer is (B)
    The outer for-loop goes for iterations. The inner for-loop runs independent of the otuer loop. And for each inner iteration n/2 gets added to k.
    ∴ Answer = n/2 x # outer loops x #Inner loops per outer loop
    # Inner loops = Θ(log n)       [∵2 Θ(log n) = Θ(n)]
    ∴ Answer =
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *