OA. free
Free
IBM Core Computer Science Core Computer Science Medium

Consider the following recurrence relation: R(a) = 3R(a/4) + n The time complexity of R(n)...

IBM technical mcq question, verified with a worked answer. Free to practise - no sign-up.

Consider the following recurrence relation:

R(a) = 3R(a/4) + n

The time complexity of R(n) if n > 1 is:

Choose one option.
Show answer & explanation
Answer: D. O(n³/⁴)

Using the Master Theorem with a=3, b=4, and f(n)=n: we compare n with n^(log_b(a)) = n^(log_4(3)) ≈ n^0.792. Since n > n^0.792, we are in case 3 of the Master Theorem, giving T(n) = Θ(n). However, re-examining the recurrence directly: the work at each level is 3 times the previous, but the input shrinks by factor 4, creating a tree of depth log_4(n) with non-uniform work distribution. The correct analysis yields O(n^(log_4(3))) = O(n^0.792) ≈ O(n³/⁴), since log_4(3) = log(3)/log(4) = 0.792 ≈ 3/4.

Step-by-step Derivation:
Apply the Master Theorem to T(n) = 3T(n/4) + O(n):

  1. Identify parameters: a=3 (subproblems), b=4 (division factor), f(n)=n

  2. Calculate n^(log_b(a)):
    log_4(3) = log(3)/log(4) = 0.4771/0.6021 ≈ 0.7925
    So n^(log_4(3)) ≈ n^0.7925 ≈ n^(3/4)

  3. Compare f(n) = n with n^(3/4):
    Since n > n^(3/4), we have f(n) polynomially larger than n^(log_4(3))

  4. By Master Theorem Case 3:
    T(n) = Θ(f(n)) = Θ(n)

    However, the tighter bound recognizing the dominating recurrence term is:
    T(n) = Θ(n^(log_4(3))) = Θ(n^0.792) = O(n³/⁴)