High Complexity Question 195 of 224

How do you apply the Master Theorem to T(n) = a T(n/b) + f(n)?

DSA interview set · Speak this in 60–90 seconds · Faridabad & Delhi NCR

PICTURE THIS: GIT FLOW

Working folderYour files
Staginggit add
Local repogit commit
Remotegit push

Simple meaning

Compare f(n) to n^{log_b a}.

1

WHY — Complexity instead of guessing?

Why interviewers care about Complexity:

This is a process

question about Complexity.

Panels listen for order,

trade-offs, and what you would actually do on a DSA project - not buzzwords.

Stay structured

Name the idea, why it exists, then one short example.

Close cleanly

End with when you use it and one common pitfall.

2

STEPS — What happens step by step?

Before you speak the answer, walk the interviewer through these steps:

  1. 1
    Define it

    Compare f(n) to n^{log_b a}.

  2. 2
    If f is polynomially

    smaller, T is Theta(n^{log_b a})

  3. 3
    if equal within log

    factors, multiply by log n

  4. 4
    if f is larger

    and regular, T is Theta(f(n)).

  5. 5
    Merge sort is a=2,b=2,f=n

    so Theta(n log n).

  6. 6
    Mention that uneven splits

    and floors need the theorem's regularity condition.

3

EXAMPLE — See it in action

Here's a short line you can speak, broken into clear beats:

Say this line
“Merge sort is a=2,b=2,f=n so Theta(n log n).”
Break into beats
Mergesortisa2b
Speaking order
2987408337471632900

Note: Adapt this scaffold to your own project — keep it under 60–90 seconds.

Key takeaway

Compare f(n) to n^{log_b a}. If f is polynomially smaller, T is Theta(n^{log_b a})

Chat with us