GATE CSE
First time here? Checkout the FAQ!
x
+1 vote
57 views

When analyzing a recurrence of the form T(n) = a T(nb) + θ(nc), under which of the following conditions can we conclude that “most of the work occurs at the leaves of the recursion tree”?

  1.   c <loga
  2.   c = logb a
  3.   c > logb a
  4.   None of these

 

asked in Algorithms by Veteran (13.2k points)   | 57 views

1 Answer

+1 vote
Best answer

Answer: Option (A)

  • Case 1: f(n) is O(nlogba - ε). Since the leaves grow faster than f, asymptotically all of the work is done at the leaves, and so T(n) is Θ(nlogb a).
  • Case 2: f(n) is Θ(nlogba). The leaves grow at the same rate as h, so the same order of work is done at every level of the tree. The tree has O(lg n) levels, times the work done on one level, yielding T(n) is Θ(nlogb a lg n).
  • Case 3: f(n) is Ω(nlogba + ε). In this case we also need to show that af(n/b)≤kf(n) for some constant k and large n, which means that f grows faster than the number of leaves. Asymptotically all of the work is done at the root node, so T(n) is Θ(f(n)).
answered by Loyal (2.6k points)  
selected by
could'nt understand much..can u explain bit more??

Yeah Sure !!!

  • See, the first  Case, it says if the value of θ(nc) is less then the Value computed by the Entire aT(nb).
  • Means , the root works θ(nc) and the children especially the Leaves work  Θ(nlogba).
  • (Simply applied Master's Theorem)
  • And relation we get is  θ(nc)<Θ(nlogba).
  • And that is nothing but c< logba.
  • So option A is correct.
  • Hope you are clear!!!

@Akriti, ma'am this might clear your concept.

T(n)=2T(n/2) + n2.

The recursion tree for this recurrence is of the following form:


 

and the children / leaves work O(n).

It is Case 2.

Just choose the answer if you get it as "Best" !!!! :)

@jason,i am understanding all the things ,you are sayng but .just tell me this-"

"Means , the root works θ(nc) and the children especially the Leaves work  Θ(nlogba)."

the recurrence is T(n) = a T(nb) + θ(nc) which means n is divided into n/b at each level.right?and at each level nc work is done..right?so how is that leaves do more or less work?overall work at all the levls will be same.right??

and pls dun call me ma'am..i am also a student like you..;):-P

MAY be i am getting u now.suppose T(n) =2T(N/2) + n2

then 

                           n                        n2

                       /        \

                    n/2        n/2               (n/2)2 + (n/2)2 

at,next level (n/4)2 + (n/4)2 + (n/4)2 + (n/4)2

hence,at leaves,work done is less.

am i right??

thanks jason..:)

Exactly Ma'am that work will be very less compared to the Work done by the Root.


Top Users Jun 2017
  1. Bikram

    3694 Points

  2. Hemant Parihar

    1484 Points

  3. junaid ahmad

    1432 Points

  4. Arnab Bhadra

    1398 Points

  5. Niraj Singh 2

    1311 Points

  6. Rupendra Choudhary

    1194 Points

  7. rahul sharma 5

    1114 Points

  8. Arjun

    930 Points

  9. srestha

    928 Points

  10. Debashish Deka

    896 Points

Monthly Topper: Rs. 500 gift card
Top Users 2017 Jun 19 - 25
  1. Bikram

    1950 Points

  2. Niraj Singh 2

    1306 Points

  3. junaid ahmad

    502 Points

  4. sudsho

    410 Points

  5. akankshadewangan24

    388 Points


23,354 questions
30,065 answers
67,363 comments
28,382 users