I have the following algorithm which takes as an input a non negative integer n :
i = n
while i > 0 do :
$\,$ $\,$ $\,$ $\,$i = i - 1
$\,$ $\,$ $\,$ $\,$j = 1
$\,$ $\,$ $\,$ $\,$ $\,$ $\,$ $\,$ $\,$while j $\le$ n do
$\,$ $\,$ $\,$ $\,$ $\,$ $\,$ $\,$ $\,$ $\,$ $\,$ $\,$ j = 2j
The outer while loop has complexity of O(n) and the inner loop has complexity of O(logn) . So i assume the complexity of the algorithm as a whole is O(nlogn) .
Is this correct ? Thank you .