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


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)).

solved What is the big O notation for this algorithm?