HiveBrain v1.2.0
Get Started
← Back to all entries
patternModerate

Why is there the regularity condition in the master theorem?

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
whytheregularityconditionmastertheoremthere

Problem

I have been reading Introduction to Algorithms by Cormen et al. and I'm reading the statement of the Master theorem starting on page 73. In case 3 there is also a regularity condition that needs to be satisfied to use the theorem:

... 3. If

$\qquad \displaystyle f(n) = \Omega(n^{\log_b a + \varepsilon})$

for some constant $\varepsilon > 0$ and if

$\qquad \displaystyle af(n/b) \leq cf(n)$      [this is the regularity condition]

for some constant $c < 1$ and for all sufficiently large $n$, then ..

Can someone tell me why the regularity condition is needed? How does the theorem fail if the condition is not satisfied?

Solution

Not a rigorous proof, but a "from the top of my head" explanation.

Imagine the recurrence $aT(n/b)+f(n)$ as a tree. The third case covers the scenario when the root node dominates the running time asymptotically, i.e. most of the work is being done in measly node on top of the recurrence tree. Then the running time is $\Theta(f(n))$.

To make sure the root actually does more work you need the


$a f(n/b) \leq cf(n)$.

This says that $f(n)$ (the amount of work done in the root) needs to be at least as big as the sum of the work done in the lower levels. (The recurrence is called $a$ times on $n/b$ of the input.)

E.g. for the recurrence $T(n)=2T(n/4)+n$ the work on the level below the root is one fourth as big and only done twice $(n/4+n/4)$ versus $n$ so the root dominates.

But what if the function didn't fulfill the regularity condition? E.g. $\cos(n)$ instead of $n$? Then the work done on the lower levels might be bigger than the work done in the root so you are not certain that the root dominates.

Context

StackExchange Computer Science Q#4854, answer score: 13

Revisions (0)

No revisions yet.