Professional Documents
Culture Documents
Introduction
M. Akra and L. Bazzi recently proposed (in 1986) a new master theorem to
analyse the asymtotic behaviour of the mathematical recurrences that appear
in the analysis of the divide and conquer algorithms.It is the generalisation of
the well known Master Theorem.
Theorem 1 As per this theorem if
h(x) = θ(1) f or1 ≤ x ≤ x0
T (x) = (1)
h(x) = Σai T (bi x) + g(x) f orx > x0
where
1. x ≥ 1 is a real number.
1 1
2. x0 is a constant such that x0 ≥ and x0 ≥ ∀1 ≤ i ≤ k.
bi 1 − bi
3. ai > 0 is a constant for 1 ≤ i ≤ k.
4. bi ǫ(0, 1) is a constant.
5. k ≥ 1 is a constant.
6. g(x) is a nonnegative function satisfying polynomial growth condition and
Pk
p be a unique number for which i=1 ai bpi = 1.
Then Z x
g(u)
T (x) = θ xp 1 + du
1 up+1
We will now prove this theorem before checking it on some examples and
going for the variations.But first let’s see what the Polynomial Growth Condition
is.
1
The proof of the Theorem 1 makes use of the following lemma :
Lemma 1 If g(x) is a non-negative function that satisfies polynomial growth
condition.Then there are constants c3 and c4 such that
Z x
g(u)
c3 g(u) ≤ xp du ≤ c4 g(u)
bi x up+1
Proof of Lemma 1:
As per the polynomial growth condition we know that for all values of x greater
than x0
Z x
g(u)
c3 g(u) ≤ xp du ≤ c4 g(u)
bi x up+1
g(u) ≤ c2 g(x)
x x Z x
1
Z Z
g(u) c2 g(x)
⇒ xp p+1
du ≤ x p
p+1
du ≤ c2 g(x)x p
p+1
du
bi x u bi x u bi x u
Z x x
p g(u) p −p
⇒x p+1
du ≤ c2 g(x)x
bi x u up+1 bi x
Z x
p g(u) p p p
⇒x du ≤ c2 g(x)x − p
bi x u
p+1 bi x p x
Z x
g(u) 1
⇒ xp du ≤ pc 2 g(x) − 1
bi x u
p+1 bi p
Z x
g(u) 1
⇒ xp du ≤ pc 2 g(x) − 1
bi x u
p+1 min(bi p )
Z x
g(u)
⇒ xp p+1
du ≤ pc4 g(x)
bi x u
where
1
c4 = pc2 −1
min(bi p )
Similarly for the upper bound
c1 g(x) ≤ g(u)
x x
1
Z Z
p g(u)
∴x du ≥ c1 g(x) du
bi x up+1 bi x xp+1
x x
p −p
Z
p g(u)
⇒x p+1
du ≥ c1 g(x)x
bi x u xp bi x
Z x
p g(u) 1
⇒x p+1
du ≥ pc1 g(x) p − 1
bi x u bi
2
x
1
Z
p g(u)
⇒x du ≥ pc1 g(x) −1
bi x u
p+1 max(bpi )
Z x
g(u)
⇒ xp p+1
du ≥ c3 g(x)
bi x u
where
1
c3 = pc1 −1
max(bi p )
Z x
p g(u)
∴ c3 g(x) ≤ x du ≤ c4 g(x)
bi x up+1
Proof of Theorem 1
We need to show the existence of two positive constants c5 and c6 such that
Z x Z x
p g(u) p g(u)
c5 x 1 + p+1
du ≤ T (x) ≤ c6 x 1 + p+1
1 u 1 u
This proof is by induction on the interval Ij The base case when j = 0 follows
from the fact that T (x) = Θ(1) when xǫ[1, x0 ]. Thus we can assign any value
to c5 and c6 depending on the value of T(x). The inductive step is argued as
follows :
k
T (x) = σi=1 ai T (bi x) + g(x)
k Z bi x !
X
p g(u)
⇒ T (x) ≥ ai C5 (bi x) 1 + du + g(x).... (by induction)
i=1 1 up+1
k Z x Z x
X
p g(u) g(u)
⇒ T (x) ≥ ai C5 (bi x) 1 + − du
i=1 1 up+1 bi x up+1
X p Z x
g(u) c4
⇒ T (x) ≥ C5 xp ai b i 1 + p+1
du − g(x) ...(by lemma 1)
1 u xp
Z x k
p g(u) X
⇒ T (x) ≥ C5 x 1 + p+1
+ g(x) − C5 C 4 g(x) ...(as ai C5 (bi x)p = 1)
1 u i=1
Z x
g(u)
⇒ T (x) ≥ C5 xp 1 + p+1
1 u
1
provided that C5 ≤ C4 .Thus there exists C5 . Now let us focus on the existence
of C6
The base case has been taken care of during the proof of existence of C5 .Now
the inductive step.
k
X
T (x) = ai T (bi x)p + g(x)
i=1
k
!
Z bi x
X
p g(u)
⇒ T (x) ≤ C6 ai (bi x) 1+ + g(x)
i=1 1 up+1
3
k Z x Z x
X
p g(u) g(u)
⇒ T (x) ≤ C6 ai (bi x) 1 + − du + g(x)
i=1 1 up+1 bi x up+1
k Z x
g(u) C3 g(x)
ai bpi 1 +
X
⇒ T (x) ≤ C6 xp p+1
− + g(x)...(by lemma 1)
i=1 1 u xp
k Z x
g(u)
ai bpi
X
p
⇒ T (x) = C6 x 1+ − C3 C6 g(x) + g(x)
i=1 1 up+1
x
1
Z
g(u)
⇒ T (x) ≤ C6 xp 1 + du provided that C6 ≥
1 up+1 C3
∴ It can be concluded that
Z x
g(u)
T (x) = θ xp 1 + du
1 up+1
Examples
Now let us take some examples to verify the correctness of this theorem
Example 1
1 x 1
T (x) = T +θ
2 2 x
As per CS-345 Master theorem
log2 x
T (x) = θ
x
4
Example 2
x x
T (x) = 2T + 3T
+ θ(x log x)
4 6
CS-345 Master theorem can’t be applied here because it is not in the form
x
T (x) = aT + f (n)
b
So, let’s solve it by recursion:
x x
T (x) = 2T + 3T
+ θ(x log x)
4 6
h x i h x i
= 2 2T + 3 3T + θ(x log x)(4 + 9 + 1)
16 18
5
Variations
We have analysed a great deal of recurrences in the previous sections.But re-
currences in real life differ in small ways.
k
X
e.g. T (x) ≤ ai T (⌈x⌉) + g(x)
i=1
In general the inclusion of floors and ceilings doesn’t affect the recursion signif-
icantly.In this section we shall see a general class of variations (including floors
and ceilings).We will show that variations don’t affect the solution of recurrences
upto a constant factor.So we need to prove the following theorem:
Theorem 2 As per this theorem if
t(x) = θ(1) f or1 ≤ x ≤ x0
T (x) = (2)
t(x) = Σai T (bi x + hi (x)) + g(x) f orx > x0
where
1. x > 1 is a real number ; x0 ≥ b1i and x0 ≥ 1−b 1
i
for all 1 ≤ i ≤ k; ai > 0
for 1 < i < k; bi ǫ(0, 1) is a constant;k ≥ 1is a constant.
2. there exists some constant ǫ > 0 for which
x
|hi (x)| ≤ 1+ǫ ∀iǫ[1, k]
log x
whenever x ≥ x0
3. there exist positive constants c1 and c2 such that for all uǫ[bi x + hi (x), x]
c1 g(x) ≤ g(u) ≤ c2 g(x)
(b)
p
1 1 1
1+ 1 − ≤ 1 −
bi log1+ǫ x
ǫ/2
ǫ/2 x log x
log bi x + log1+ǫ x
(c)
1 1
1+ ≤1
2 logǫ/2
(d)
1
2 1− ≥1
logǫ/2 x
6
Before going into prove of Theorem 2 we need to prove the following lemma
Lemma 2 There are positive constants c3 , c4 such that for 1 ≤ i ≤ k and all
x≥1 Z x
p g(u)
c3 g(x) ≤ x p+1
du ≤ c4 g(x)
bi x+hi (x) u
Proof of Lemma 2
we know that for uǫ[bi x + hi (x), x] c1 g(x) ≤ g(u) ≤ c2 g(x)
x x
1
Z Z
g(u)
⇒ xp du ≤ xp c2 g(x) du
bi x+hi (x) up+1 bi x up+1
x x
−p
Z
g(u)
⇒ xp p+1
du ≤ x p
c 2 g(x)
bi x+hi (x) u up bi x
Z x
g(u) 1
⇒ xp p+1
du ≤ pc 2 g(x) − 1
bi x+hi (x) u min(bi )p
Z x
g(u) 1
⇒ xp p+1
du ≤ c 4 g(x) where c 4 = pc 2 g(x) − 1
bi x+hi (x) u min(bi )p
as because
x
|hi (x)| ≤ i+ǫ
log x
∴ for sufficiently large x > x0 hix(x)
x
log1+ǫ x 1
lim = lim 1+ǫ = lim 1+ǫ
x→∞ x x→∞ x log x x→∞ log x
7
log x for x → ∞ tends to ∞
h1 x
∴ →0
x
x
1
Z
g(u)
∴ xp du ≥ pc 1 g(x) − 1
bi x+hi (x) up+1 bpi
Z x
g(u)
⇒ xp du ≥ c3 g(x)
bi x+hi (x) up+1
Hence lemma 2 is proved.
Proof of Theorem 2
Here we begin by showing that there is a positive constant c5 such that for all
x > x0 Z x
p 1 g(u)
T (x) ≥ c5 x 1 + 1+ p+1
du
logǫ/2 x 1 u
k
!
X
p 1
⇒ T (x) ≥ ai c5 (bi x+hi (x)) 1+ +g(x) (by induction)
i=1 logǫ/2 (bi x + hi (x))
k p Z x
X 1 1 g(u)
⇒ T (x) ≥ ai c5 xp 1 − 1 + 1+ −
bi log1+ǫ x p+1
i=1 logǫ/2 bi x + log1+ǫ
x 1 u
x
8
Now let’s do the lower bound. Here we show by induction the existence of a
positive constant c6 such that for all x > x0
Z x
p 1 g(u)
T (x) ≤ c6 x 1 − 1+ p+1
du
logǫ/2 x 1 u
The base case is when T (x) = θ(1) and when x ∈ [1, x0 ] we can choose c6
accordingly.The inductive step is as:
k
X
T (x) = ai T (bi x + hi (x)) + g(x)
i=1
k
! !
bi x+hi (x)
1
Z
X
p g(u)
⇒ T (x) ≤ ai c6 (bi x+hi (x)) 1− 1+ (by induction) du +g(x)
i=1 logǫ/2 (bi x + hi (x)) 1 up+1
k p Z x Z x !
X p p 1 1 g(u)
⇒ T (x) ≤ ai b i c6 x 1 + 1 − 1 + − +g(x)
bi log1+ǫ x p+1
i=1 logǫ/2 bi x + log1+ǫ
x 1 u bi x+hi (x)
x
Z x
g(u) c3
⇒ T (x) ≤ c6 xp 1 − logǫ/2 x 1+ p+1
du − p g(x) + g(x)
1 u x
(by constraint 4(b) and lemma 2)
Z x
1 g(u) 1
⇒ T (x) ≤ c6 xp 1 − 1 + p+1
du +g(x)−c c
3 6 1 − g(x)
logǫ/2 x 1 u logǫ/2 x
Z x
p 1 g(u)
⇒ T (x) ≤ c6 x 1 − 1+ p+1
du
logǫ/2 x 1 u
9
Let 2c5 = c7 and c26 = c8 Therefore
Z x Z x
p g(u) p g(u)
c7 x 1 + p+1
du ≤ T (x) ≤ c8 x 1 + p+1
du
1 u 1 u
Z x
g(u)
∴ T (x) = θ xp 1 + p+1
du
1 u
References
1. Notes on Better Master Theorems for Divide-and-Conquer Recurrences
by Tom Leighton
2. http://www.algorithmsblog.com
3. http://en.wikipedia.org
10