how to calculate the running analysis for the worst case of the two above algorithms??Code:`sum=0;`

for (i=1; i<=n; i*=2)

for (j=1; j<=i; j++)

sum++;

r=0

for(i=1; i<= n ; i++)

for (j = 1; j <= n; j*=2)

if (n mod 2 == 0) // n even

for (k = 1; k <= n; k++)

r++;

else // n odd

r--;