need help finding time complexity of this loop

25 Views Asked by At

What is the time complexity of the following algorithm?

 SUMAB (A, B, N)
   sum = 0
   for j = 1.. N
      k = 2
      while k<N
        sum - sum + A[j] * B[k]
        k = k * k
  return sum
1

There are 1 best solutions below

0
On BEST ANSWER

It's $O(n\log \log n)$. You can see this by noting that the inner loop performs $i$ operations where $2^{2^i} = n$.