[Solved] What is the big O notation for this algorithm?

[ad_1]

As i is multiplied by 2 each time in a while, Hence the while loop will be run log(n) times. And inner for loop will be run in O(n^2) as i is at most n. Hence, the time complexity of the code in O notation is O(n^2 log(n)).

[ad_2]

solved What is the big O notation for this algorithm?