edited by
514 views
0 votes
0 votes
Q1 )  j = $\frac{n}{2}$ + $\frac{n}{4}$ + $\frac{n}{8}$ + ....... + 1  = O ( ?? )

Q 2 )  j = 1 + $\frac{1}{2}$ +  $\frac{1}{3}$ + $\frac{1}{4}$ +..... = O ( ?? )

Q3 )

while ( i=n >0)
 {
j=i/2    
 i--
}
Q4)

While (i=0  <= n)
{
j=i*2
i++
}
Q5

while ( i=n >0)
{
j=j+i
i=i/2
}
edited by

1 Answer

Related questions

3 votes
3 votes
2 answers
2
Shubhanshu asked Sep 21, 2017
549 views
Consider following program and determine the value of p after execution of program:-main() { p = 1; for(i=1;i<=n;i++) { for(j=1;j<=n;j=5*j) { p = p + n; } } }I think p's ...
1 votes
1 votes
2 answers
3
sh!va asked Dec 4, 2016
1,009 views
for (int i = 1; i <=m; i += c){ -do something -}for (int i = 1; i <=n; i += c){ -do something - }What will the the tiem complexity of given code pseudococde?A. O (m...
2 votes
2 votes
2 answers
4
Hardik Vagadia asked Aug 20, 2016
1,841 views
For(i=1;i<(1<<n);i++) { Do something }What is the meaning of the expression in the condition part of the for loop?