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...

What is the time complexity T(n) of the nested loops
below? For simplicity, you may assume that n is a power of
2. That is, n = 2k for some positive integer k.
:
i = n;
while (i >= 1){
j = i;
while (j <= n) {
<body of the inner while loop > //
Needs &#61553;(1).
j = 2 * j;
}
i = &#61675;i/2&#61691;;
}
:

Answer Posted / muhammad ijaz khan

The outer loop divides the working area in half in each
iteration. So the running time of this algorithm is
proportional to the number of times n can be divided by 2.
The inner loop will be executed unlimitted time. So
the time complexity of the outer loop will be the function
of ln and the total time is: T(n)= n*ln n

Is This Answer Correct ?    10 Yes 20 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how to create user name stape by stape in cisco router {with command}

3116


what is the difference between a decision statement and ea loop statement?

2389


consiteunts of indian railways

2300


Differentiate y = sinx + cosx + tanx

1049


How do trains go around bends?

1091


I want to join for load runner training..please suggest me which is the best institute for load runner training in bangalore?

1502


How to Shut-down the system through QTP Script?

1845


as we know that java is a platform independent language, but we need jvm for the same operating system why?

1933


there are 50 users in a network, one system is virus affected , how to find that virus affected system?

1851


plz send me interview questions & answers of Data Structure

2052


tell the function of Source record of DNS server. why we create Stub zone? Tell Round Robing also?

1992


sir , i am prparing for IOCL engineergin post please send me the old placement papers

2052


how bluetooth works?what is principle behind in it?

6736


how convert the spiral model to prototype model ?

1714


Write a program to input 10 elements in an array and seperate even and odd numbers, positive and negative between them ?

1794