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 EVA granules manufactured (I wanted to know the manufacturing process). (Virgin Granules) and what are the Raw Materials used.

1849


sir/medam i had completed my B-TECH(CSE)2011 with 61%.i have to go USA for futhure studies.i dnt know what is steps for do futhure studies in USA so could you please tell me

2031


Hi, what is the meaning of DOCUMENTUM,how and what testers have to do with it?

6209


hi friends i am b-tech in computer science having interview of State bank of india clerk day on 30 th april. I want to know the answer of question:"you r B.tech in C.S. why do u want to become a bank clerk?" please help.Its my humble request.

2010


what is mean by tranducer

2161


what is static identifier in c language?

2167


i am going to give interview for the post of ibps po..so there is a question in my mind which is "Being an electonics and communication engineer how can you help in banks, I mean whats the application of your education in banking."

2153


what is the definition(body) of a default constructor in c++?

1958


dam,rivers,states capt,

2264


how will u recieve idoc

2011


. Give the C language equivalents of the following a)Function returning an int pointer b)Function pointer returning an int pointer c)Function pointer returning an array of integers d)Array of function pointer returning an array of integers

2077


a steel bar 1' inch square 6' long is to be used as a column.ends are free to rotate put may not be displaced.stress is limited to 30,000 PSI

1840


what is different between static block and public static void main??

1881


What is the difference between a gun and a rifle and what advantage does a spinning bullet have?

1394


How we calculate the recovery of steam as per coal in a boiler if we know the calorific value of coal?

1814