for (i = 1; i <= n; i++)
{
j = n;
while (j >= 1)
{
// body of the while loop // requires θ(1) time
j = ⌊j/2⌋
}
}
i = n;
while (i >= 1)
{
j = i;
while (j <= n)
{
// body of while loop // requires θ(1) time
j = j * 2;
}
i = ⌊i/2⌋
}