Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Complexity T(n)

What is the time complexity T(n) of the following portions
of code? For simplicity, you may assume that n is a power of
2. That is, n = 2k for some positive integer k.

a) ?
for (i = 1; i <= n; i++)
{
j = n; cout << i << ? ? j << ? ? << endl;
}

b) ?
for (i = 0; i <= n; i += 2)
{
j = n; cout << i << ? ? j << ? ? << endl;
}

c) ?
for (i = n; i >= 1; i = i/2)
{
j = n; cout << i << ? ? j << ? ? << endl;
}

d)
for (i = 1; i <= n; i++)
{ j = n;
while (j >= 0)
{ cout << i << ? ? j << ? ? << endl;
j = j - 2;
}
}


No Answer is Posted For this Question
Be the First to Post Answer

Post New Answer

More C++ Code Interview Questions

A suduco given & u hv 2 check if it is incomplete(blanks left),or correct or incorrect

0 Answers  


Write a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors.

3 Answers   TCS, Vimukti Technologies, Wipro,


write a program to sort 'n' elemnts using bubble sort

1 Answers   IBM,


. Write a program using two-dimensional arrays that computes the sum of data in tows and the sum of data in columns of the 3x3 (three by three) array variable n[3][3].

2 Answers   IBM,


write a program to perform generic sort in arrays?

0 Answers  


write a function that reverse the elements of an array in place.The function must accept only one pointer value and return void.

0 Answers   HCL, SRCASW,


Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)

0 Answers   iGate,


how to take time as input in the format (12:02:13) from user so that controls remains between these columns?

0 Answers  


Ask the user to input three positive integers M, N and q. Make the 2 dimensional array of integers with size MxN, where all the elements of I (I = 1,…,M) line will be members of geometrical progression with first element equal to the number of line (I) and denominator q.

0 Answers  


What will be the output- for(i=1;i<=3;i++) { printf("%d",i); continue; i++; }

5 Answers   Impetus,


Write a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors.

5 Answers   ADP, Amazon, HCL, IBM, Infosys, Satyam, TCS, Vimukti Technologies,


Write a function- oriented to convert the input dollar(s) into its equivalent peso. Assume that one dollar is equivalent to 51.60

1 Answers  


Categories