347 views
0 votes
0 votes
what is the time complexities of the following code snippets.

 

1.

k=1;i=1;
while(k<=n)
{
    i++;
    k=k+i;
}

 

 

2.

for(i=1;i<=n;++i)
{
    for(j=1;j<n;j=j*2)
    c=c+1;
}

 

 

 

3.
m=pow(2,n)
for(i=1;i<=n;i++)
{
    for(j=1;j<=m;j=j*2)
    c=c+1;
}

Please log in or register to answer this question.

Related questions

0 votes
0 votes
1 answer
1
1 votes
1 votes
1 answer
2
saumya mishra asked Jul 11, 2018
904 views
Arrange them in increasing order
1 votes
1 votes
2 answers
3
Devshree Dubey asked Mar 6, 2018
529 views
Find theta bound forf(n)=$n^2/2 -n/2$