Question

The Master Method is a direct way to get the solution. The Master Method works only for following type of recurrences or for recurrences that can be transformed to following type.

T(n) = a T(n / b) + f(n) where a ≥ 1, b > 1, and f(n) = Θ(nc).

There are following three cases:

  1. If c < logb(a) then T(n) = Θ(nlogb(a)).

  2. If c = logb(a) then T(n) = Θ(nc log(n)).

  3. If c > logb(a) then T(n) = Θ(f(n)).

In the Master Method, if f(n) contains some term of log(n), is it possible to solve this by the Master Method? for example in T(n)=4T(n/2)+n^2logn Here master's theorem appplicable or not

Was it helpful?

Solution

It is not really possible to tell directly whether or not the Master Method works for some logarithmic function. This would depend on the specific recurrence you're trying to solve. It all depends on how f grows in comparison to nlogb a.

In the example given by JPC (where T(n) = 4T(n/2) + log(n)), it is indeed possible. However, also consider the example T(n) = 2T(n/5) + log(n). In this recurrence it is harder to determine whether nlog5 2 grows faster than log(n). If the logarithmic function f(n) gets more complex (e.g. log3(n/2)), it becomes even harder.

In short, it may be hard to determine for logarithmic functions how they grow when compared to an exponential function when the exponent is less than 1 (for exponents >= 1, log(n) is always faster). If it doesn't seem to work for you, you'll have to use other techniques to solve the recurrence.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top