3

Master theorem can be used to solve recurrence relations like T(n)= aT(n/b)+f(n).

So, if f(n)=O(n) or if f(n)=cn are both the values same? can I use master theorem for f(n)=cn also?

Carlos
  • 5,991
  • 6
  • 43
  • 82
pratik watwani
  • 117
  • 1
  • 2
  • 11
  • Constants such as `c` are often ignored when considering asymptotic relations. This is because as `n` becomes sufficiently large, the constant makes it very hard to calculate memory consumption and running time.This would mean that `f(n)=n`, which is equivalent to `f(n)=O(n)` – Evan Bechtol May 18 '16 at 12:21

2 Answers2

3

Asumming that c is a constant and that I understand your question correctly, the solution will be the same for both f(n) = O(n) and f(n) = cn, since cn = O(n) and thus the Master theorem can be applied to solve the recurrance.

mort
  • 12,988
  • 14
  • 52
  • 97
2

If I understood the question correctly, f(n)=cn (where c is a constant) is in O(n); the master theorem can be applied.

Codor
  • 17,447
  • 9
  • 29
  • 56