6.2 master theorem · 6.2 master theorem we prove the master theorem for the case that nis of the...
TRANSCRIPT
![Page 1: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/1.jpg)
6.2 Master Theorem
Lemma 4Let a ≥ 1, b ≥ 1 and ε > 0 denote constants. Consider the
recurrence
T(n) = aT(nb
)+ f(n) .
Case 1.
If f(n) = O(nlogb(a)−ε) then T(n) = Θ(nlogb a).
Case 2.
If f(n) = Θ(nlogb(a) logkn) then T(n) = Θ(nlogb a logk+1n).
Case 3.
If f(n) = Ω(nlogb(a)+ε) and for sufficiently large naf(nb ) ≤ cf(n) for some constant c < 1 then T(n) = Θ(f (n)).
Note that the cases do not cover all pos-sibilities.
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 41/596
![Page 2: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/2.jpg)
6.2 Master Theorem
We prove the Master Theorem for the case that n is of the form
b`, and we assume that the non-recursive case occurs for
problem size 1 and incurs cost 1.
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 42/596
![Page 3: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/3.jpg)
The Recursion Tree
The running time of a recursive algorithm can be visualized by a
recursion tree:
x
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
11111111 1 1 1 1 1 1 1
a a a a a a a a a
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 43/596
![Page 4: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/4.jpg)
The Recursion Tree
The running time of a recursive algorithm can be visualized by a
recursion tree:
xn
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
11111111 1 1 1 1 1 1 1
a a a a a a a a a
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 43/596
![Page 5: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/5.jpg)
The Recursion Tree
The running time of a recursive algorithm can be visualized by a
recursion tree:
xn
nb
nb
nb
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
11111111 1 1 1 1 1 1 1
a
a a a a a a a a a
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 43/596
![Page 6: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/6.jpg)
The Recursion Tree
The running time of a recursive algorithm can be visualized by a
recursion tree:
xn
nb
nb
nb
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
11111111 1 1 1 1 1 1 1
a
aaa
a a a a a a a a a
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 43/596
![Page 7: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/7.jpg)
The Recursion Tree
The running time of a recursive algorithm can be visualized by a
recursion tree:
xn
nb
nb
nb
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
11111111 1 1 1 1 1 1 1
a
aaa
a a a a a a a a a
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 43/596
![Page 8: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/8.jpg)
The Recursion Tree
The running time of a recursive algorithm can be visualized by a
recursion tree:
x f(n)n
nb
nb
nb
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
11111111 1 1 1 1 1 1 1
a
aaa
a a a a a a a a a
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 43/596
![Page 9: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/9.jpg)
The Recursion Tree
The running time of a recursive algorithm can be visualized by a
recursion tree:
x f(n)
af(nb )
n
nb
nb
nb
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
11111111 1 1 1 1 1 1 1
a
aaa
a a a a a a a a a
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 43/596
![Page 10: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/10.jpg)
The Recursion Tree
The running time of a recursive algorithm can be visualized by a
recursion tree:
x f(n)
af(nb )
a2f( nb2 )
n
nb
nb
nb
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
11111111 1 1 1 1 1 1 1
a
aaa
a a a a a a a a a
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 43/596
![Page 11: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/11.jpg)
The Recursion Tree
The running time of a recursive algorithm can be visualized by a
recursion tree:
x f(n)
af(nb )
a2f( nb2 )
alogbn
n
nb
nb
nb
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
11111111 1 1 1 1 1 1 1
a
aaa
a a a a a a a a a
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 43/596
![Page 12: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/12.jpg)
The Recursion Tree
The running time of a recursive algorithm can be visualized by a
recursion tree:
x f(n)
af(nb )
a2f( nb2 )
alogbn
nlogba=
n
nb
nb
nb
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
11111111 1 1 1 1 1 1 1
a
aaa
a a a a a a a a a
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 43/596
![Page 13: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/13.jpg)
6.2 Master Theorem
This gives
T(n) = nlogb a +logb n−1∑i=0
aif(nbi
).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 44/596
![Page 14: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/14.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 45/596
![Page 15: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/15.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a
=logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 45/596
![Page 16: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/16.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 45/596
![Page 17: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/17.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 45/596
![Page 18: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/18.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
b−i(logb a−ε) = bεi(blogb a)−i = bεia−i
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 45/596
![Page 19: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/19.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
b−i(logb a−ε) = bεi(blogb a)−i = bεia−i
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 45/596
![Page 20: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/20.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
∑ki=0 qi = qk+1−1
q−1
b−i(logb a−ε) = bεi(blogb a)−i = bεia−i
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 45/596
![Page 21: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/21.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
∑ki=0 qi = qk+1−1
q−1
b−i(logb a−ε) = bεi(blogb a)−i = bεia−i
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 45/596
![Page 22: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/22.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
∑ki=0 qi = qk+1−1
q−1
b−i(logb a−ε) = bεi(blogb a)−i = bεia−i
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 45/596
![Page 23: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/23.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
∑ki=0 qi = qk+1−1
q−1
b−i(logb a−ε) = bεi(blogb a)−i = bεia−i
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 45/596
![Page 24: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/24.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
∑ki=0 qi = qk+1−1
q−1
b−i(logb a−ε) = bεi(blogb a)−i = bεia−i
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 45/596
![Page 25: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/25.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
∑ki=0 qi = qk+1−1
q−1
b−i(logb a−ε) = bεi(blogb a)−i = bεia−i
⇒ T(n) = O(nlogb a).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 45/596
![Page 26: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/26.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = O(nlogb a logb n)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 46/596
![Page 27: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/27.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a.
T(n)−nlogb a
=logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = O(nlogb a logb n)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 46/596
![Page 28: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/28.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = O(nlogb a logb n)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 46/596
![Page 29: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/29.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = O(nlogb a logb n)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 46/596
![Page 30: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/30.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = O(nlogb a logb n)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 46/596
![Page 31: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/31.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = O(nlogb a logb n)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 46/596
![Page 32: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/32.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = O(nlogb a logb n)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 46/596
![Page 33: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/33.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = O(nlogb a logb n) ⇒ T(n) = O(nlogb a logn).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 46/596
![Page 34: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/34.jpg)
Case 2. Now suppose that f(n) ≥ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≥ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = Ω(nlogb a logb n)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 47/596
![Page 35: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/35.jpg)
Case 2. Now suppose that f(n) ≥ cnlogb a.
T(n)−nlogb a
=logb n−1∑i=0
aif(nbi
)
≥ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = Ω(nlogb a logb n)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 47/596
![Page 36: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/36.jpg)
Case 2. Now suppose that f(n) ≥ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≥ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = Ω(nlogb a logb n)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 47/596
![Page 37: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/37.jpg)
Case 2. Now suppose that f(n) ≥ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≥ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = Ω(nlogb a logb n)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 47/596
![Page 38: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/38.jpg)
Case 2. Now suppose that f(n) ≥ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≥ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = Ω(nlogb a logb n)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 47/596
![Page 39: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/39.jpg)
Case 2. Now suppose that f(n) ≥ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≥ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = Ω(nlogb a logb n)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 47/596
![Page 40: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/40.jpg)
Case 2. Now suppose that f(n) ≥ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≥ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = Ω(nlogb a logb n)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 47/596
![Page 41: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/41.jpg)
Case 2. Now suppose that f(n) ≥ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≥ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = Ω(nlogb a logb n) ⇒ T(n) = Ω(nlogb a logn).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 47/596
![Page 42: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/42.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
∑i=1
ik ≈ 1k`k+1
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 48/596
![Page 43: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/43.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a
=logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
∑i=1
ik ≈ 1k`k+1
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 48/596
![Page 44: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/44.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
∑i=1
ik ≈ 1k`k+1
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 48/596
![Page 45: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/45.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
∑i=1
ik ≈ 1k`k+1
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 48/596
![Page 46: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/46.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
n = b` ⇒ ` = logb n
∑i=1
ik ≈ 1k`k+1
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 48/596
![Page 47: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/47.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
n = b` ⇒ ` = logb n
∑i=1
ik ≈ 1k`k+1
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 48/596
![Page 48: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/48.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
n = b` ⇒ ` = logb n
∑i=1
ik ≈ 1k`k+1
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 48/596
![Page 49: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/49.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
n = b` ⇒ ` = logb n
∑i=1
ik ≈ 1k`k+1
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 48/596
![Page 50: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/50.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
n = b` ⇒ ` = logb n
∑i=1
ik ≈ 1k`k+1
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 48/596
![Page 51: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/51.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
n = b` ⇒ ` = logb n
∑i=1
ik ≈ 1k`k+1
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 48/596
![Page 52: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/52.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
n = b` ⇒ ` = logb n
∑i=1
ik ≈ 1k`k+1
⇒ T(n) = O(nlogb a logk+1n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 48/596
![Page 53: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/53.jpg)
Case 3. Now suppose that f(n) ≥ dnlogb a+ε, and that for
sufficiently large n: af(n/b) ≤ cf(n), for c < 1.
From this we get aif(n/bi) ≤ cif(n), where we assume that
n/bi−1 ≥ n0 is still sufficiently large.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
=logb n−1∑i=0
cif(n)+O(nlogb a)
≤ 11− c f(n)+O(n
logb a)
Hence,
T(n) ≤ O(f (n))
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 49/596
![Page 54: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/54.jpg)
Case 3. Now suppose that f(n) ≥ dnlogb a+ε, and that for
sufficiently large n: af(n/b) ≤ cf(n), for c < 1.
From this we get aif(n/bi) ≤ cif(n), where we assume that
n/bi−1 ≥ n0 is still sufficiently large.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
=logb n−1∑i=0
cif(n)+O(nlogb a)
≤ 11− c f(n)+O(n
logb a)
Hence,
T(n) ≤ O(f (n))
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 49/596
![Page 55: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/55.jpg)
Case 3. Now suppose that f(n) ≥ dnlogb a+ε, and that for
sufficiently large n: af(n/b) ≤ cf(n), for c < 1.
From this we get aif(n/bi) ≤ cif(n), where we assume that
n/bi−1 ≥ n0 is still sufficiently large.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
=logb n−1∑i=0
cif(n)+O(nlogb a)
≤ 11− c f(n)+O(n
logb a)
Hence,
T(n) ≤ O(f (n))
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 49/596
![Page 56: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/56.jpg)
Case 3. Now suppose that f(n) ≥ dnlogb a+ε, and that for
sufficiently large n: af(n/b) ≤ cf(n), for c < 1.
From this we get aif(n/bi) ≤ cif(n), where we assume that
n/bi−1 ≥ n0 is still sufficiently large.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
=logb n−1∑i=0
cif(n)+O(nlogb a)
≤ 11− c f(n)+O(n
logb a)
Hence,
T(n) ≤ O(f (n))
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 49/596
![Page 57: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/57.jpg)
Case 3. Now suppose that f(n) ≥ dnlogb a+ε, and that for
sufficiently large n: af(n/b) ≤ cf(n), for c < 1.
From this we get aif(n/bi) ≤ cif(n), where we assume that
n/bi−1 ≥ n0 is still sufficiently large.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
=logb n−1∑i=0
cif(n)+O(nlogb a)
≤ 11− c f(n)+O(n
logb a)
Hence,
T(n) ≤ O(f (n))
q < 1 :∑ni=0 qi = 1−qn+1
1−q ≤ 11−q
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 49/596
![Page 58: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/58.jpg)
Case 3. Now suppose that f(n) ≥ dnlogb a+ε, and that for
sufficiently large n: af(n/b) ≤ cf(n), for c < 1.
From this we get aif(n/bi) ≤ cif(n), where we assume that
n/bi−1 ≥ n0 is still sufficiently large.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
=logb n−1∑i=0
cif(n)+O(nlogb a)
≤ 11− c f(n)+O(n
logb a)
Hence,
T(n) ≤ O(f (n))
q < 1 :∑ni=0 qi = 1−qn+1
1−q ≤ 11−q
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 49/596
![Page 59: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/59.jpg)
Case 3. Now suppose that f(n) ≥ dnlogb a+ε, and that for
sufficiently large n: af(n/b) ≤ cf(n), for c < 1.
From this we get aif(n/bi) ≤ cif(n), where we assume that
n/bi−1 ≥ n0 is still sufficiently large.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
=logb n−1∑i=0
cif(n)+O(nlogb a)
≤ 11− c f(n)+O(n
logb a)
Hence,
T(n) ≤ O(f (n))
q < 1 :∑ni=0 qi = 1−qn+1
1−q ≤ 11−q
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 49/596
![Page 60: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/60.jpg)
Case 3. Now suppose that f(n) ≥ dnlogb a+ε, and that for
sufficiently large n: af(n/b) ≤ cf(n), for c < 1.
From this we get aif(n/bi) ≤ cif(n), where we assume that
n/bi−1 ≥ n0 is still sufficiently large.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
=logb n−1∑i=0
cif(n)+O(nlogb a)
≤ 11− c f(n)+O(n
logb a)
Hence,
T(n) ≤ O(f (n))
q < 1 :∑ni=0 qi = 1−qn+1
1−q ≤ 11−q
⇒ T(n) = Θ(f (n)).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 49/596
![Page 61: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/61.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0001001101
111011001
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 62: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/62.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0001001101
111011001
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 63: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/63.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0001001101
111011001
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 64: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/64.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0001001101
111011001
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 65: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/65.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0
001001101
1
11011001
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 66: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/66.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0
001001101
1
11011001
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 67: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/67.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
00
01001101
11
1011001
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 68: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/68.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
00
01001101
11
1011001
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 69: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/69.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
000
1001101
111
011001
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 70: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/70.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
000
1001101
111
011001
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 71: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/71.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0001
001101
1110
11001
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 72: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/72.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0001
001101
1110
11001
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 73: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/73.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
00010
01101
11101
1001
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 74: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/74.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
00010
01101
11101
1001
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 75: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/75.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
000100
1101
111011
001
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 76: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/76.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
000100
1101
111011
001
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 77: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/77.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0001001
101
1110110
01
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 78: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/78.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0001001
101
1110110
01
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 79: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/79.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
00010011
01
11101100
1
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 80: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/80.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
00010011
01
11101100
1
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 81: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/81.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
000100110
1
111011001
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 82: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/82.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
000100110
1
111011001
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 83: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/83.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0001001101
111011001
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 84: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/84.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0001001101
111011001
This gives that two n-bit integers can be added in time O(n).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 50/596
![Page 85: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/85.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 51/596
![Page 86: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/86.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 51/596
![Page 87: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/87.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 51/596
![Page 88: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/88.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 51/596
![Page 89: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/89.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 51/596
![Page 90: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/90.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
0
10001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 51/596
![Page 91: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/91.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 51/596
![Page 92: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/92.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 51/596
![Page 93: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/93.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
00
00000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 51/596
![Page 94: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/94.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 51/596
![Page 95: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/95.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 51/596
![Page 96: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/96.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
000
10001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 51/596
![Page 97: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/97.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 51/596
![Page 98: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/98.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 51/596
![Page 99: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/99.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 51/596
![Page 100: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/100.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 51/596
![Page 101: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/101.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).
ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 51/596
![Page 102: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/102.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 51/596
![Page 103: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/103.jpg)
Example: Multiplying Two Integers
A recursive approach:
Suppose that integers A and B are of length n = 2k, for some k.
AB × . . .. . . . . . . . .. . . . . . a0anb0bn an2−1an
2bn
2−1bn2
B0B1 A0A1
Then it holds that
A = A1 · 2n2 +A0 and B = B1 · 2
n2 + B0
Hence,
A · B = A1B1 · 2n + (A1B0 +A0B1) · 2n2 +A0 · B0
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 52/596
![Page 104: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/104.jpg)
Example: Multiplying Two Integers
A recursive approach:
Suppose that integers A and B are of length n = 2k, for some k.
AB ×
. . .. . . . . . . . .. . . . . . a0anb0bn an2−1an
2bn
2−1bn2
B0B1 A0A1
Then it holds that
A = A1 · 2n2 +A0 and B = B1 · 2
n2 + B0
Hence,
A · B = A1B1 · 2n + (A1B0 +A0B1) · 2n2 +A0 · B0
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 52/596
![Page 105: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/105.jpg)
Example: Multiplying Two Integers
A recursive approach:
Suppose that integers A and B are of length n = 2k, for some k.
AB
× . . .. . .
. . . . . .. . . . . .
a0anb0bn
an2−1an
2bn
2−1bn2
B0B1 A0A1
Then it holds that
A = A1 · 2n2 +A0 and B = B1 · 2
n2 + B0
Hence,
A · B = A1B1 · 2n + (A1B0 +A0B1) · 2n2 +A0 · B0
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 52/596
![Page 106: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/106.jpg)
Example: Multiplying Two Integers
A recursive approach:
Suppose that integers A and B are of length n = 2k, for some k.
AB
×
. . .. . .
. . . . . .. . . . . . a0anb0bn an2−1an
2bn
2−1bn2
B0B1 A0A1
Then it holds that
A = A1 · 2n2 +A0 and B = B1 · 2
n2 + B0
Hence,
A · B = A1B1 · 2n + (A1B0 +A0B1) · 2n2 +A0 · B0
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 52/596
![Page 107: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/107.jpg)
Example: Multiplying Two Integers
A recursive approach:
Suppose that integers A and B are of length n = 2k, for some k.
AB
×
. . .. . . . . . . . .. . . . . . a0anb0bn an2−1an
2bn
2−1bn2
B0B1 A0A1
Then it holds that
A = A1 · 2n2 +A0 and B = B1 · 2
n2 + B0
Hence,
A · B = A1B1 · 2n + (A1B0 +A0B1) · 2n2 +A0 · B0
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 52/596
![Page 108: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/108.jpg)
Example: Multiplying Two Integers
A recursive approach:
Suppose that integers A and B are of length n = 2k, for some k.
AB
×
. . .. . . . . . . . .. . . . . . a0anb0bn an2−1an
2bn
2−1bn2
B0B1 A0A1
Then it holds that
A = A1 · 2n2 +A0 and B = B1 · 2
n2 + B0
Hence,
A · B = A1B1 · 2n + (A1B0 +A0B1) · 2n2 +A0 · B0
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 52/596
![Page 109: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/109.jpg)
Example: Multiplying Two Integers
A recursive approach:
Suppose that integers A and B are of length n = 2k, for some k.
AB
×
. . .. . . . . . . . .. . . . . . a0anb0bn an2−1an
2bn
2−1bn2
B0B1 A0A1
Then it holds that
A = A1 · 2n2 +A0 and B = B1 · 2
n2 + B0
Hence,
A · B = A1B1 · 2n + (A1B0 +A0B1) · 2n2 +A0 · B0
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 52/596
![Page 110: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/110.jpg)
Example: Multiplying Two Integers
Algorithm 3 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z1 ←mult(A1, B0)+mult(A0, B1)7: Z0 ←mult(A0, B0)8: return Z2 · 2n + Z1 · 2
n2 + Z0
We get the following recurrence:
T(n) = 4T(n
2
)+O(n) .
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 53/596
![Page 111: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/111.jpg)
Example: Multiplying Two Integers
Algorithm 3 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z1 ←mult(A1, B0)+mult(A0, B1)7: Z0 ←mult(A0, B0)8: return Z2 · 2n + Z1 · 2
n2 + Z0
O(1)
We get the following recurrence:
T(n) = 4T(n
2
)+O(n) .
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 53/596
![Page 112: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/112.jpg)
Example: Multiplying Two Integers
Algorithm 3 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z1 ←mult(A1, B0)+mult(A0, B1)7: Z0 ←mult(A0, B0)8: return Z2 · 2n + Z1 · 2
n2 + Z0
O(1)O(1)
We get the following recurrence:
T(n) = 4T(n
2
)+O(n) .
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 53/596
![Page 113: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/113.jpg)
Example: Multiplying Two Integers
Algorithm 3 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z1 ←mult(A1, B0)+mult(A0, B1)7: Z0 ←mult(A0, B0)8: return Z2 · 2n + Z1 · 2
n2 + Z0
O(1)O(1)O(n)
We get the following recurrence:
T(n) = 4T(n
2
)+O(n) .
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 53/596
![Page 114: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/114.jpg)
Example: Multiplying Two Integers
Algorithm 3 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z1 ←mult(A1, B0)+mult(A0, B1)7: Z0 ←mult(A0, B0)8: return Z2 · 2n + Z1 · 2
n2 + Z0
O(1)O(1)O(n)O(n)
We get the following recurrence:
T(n) = 4T(n
2
)+O(n) .
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 53/596
![Page 115: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/115.jpg)
Example: Multiplying Two Integers
Algorithm 3 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z1 ←mult(A1, B0)+mult(A0, B1)7: Z0 ←mult(A0, B0)8: return Z2 · 2n + Z1 · 2
n2 + Z0
O(1)O(1)O(n)O(n)T(n2 )
We get the following recurrence:
T(n) = 4T(n
2
)+O(n) .
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 53/596
![Page 116: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/116.jpg)
Example: Multiplying Two Integers
Algorithm 3 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z1 ←mult(A1, B0)+mult(A0, B1)7: Z0 ←mult(A0, B0)8: return Z2 · 2n + Z1 · 2
n2 + Z0
O(1)O(1)O(n)O(n)T(n2 )2T(n2 )+O(n)
We get the following recurrence:
T(n) = 4T(n
2
)+O(n) .
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 53/596
![Page 117: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/117.jpg)
Example: Multiplying Two Integers
Algorithm 3 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z1 ←mult(A1, B0)+mult(A0, B1)7: Z0 ←mult(A0, B0)8: return Z2 · 2n + Z1 · 2
n2 + Z0
O(1)O(1)O(n)O(n)T(n2 )2T(n2 )+O(n)T(n2 )
We get the following recurrence:
T(n) = 4T(n
2
)+O(n) .
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 53/596
![Page 118: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/118.jpg)
Example: Multiplying Two Integers
Algorithm 3 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z1 ←mult(A1, B0)+mult(A0, B1)7: Z0 ←mult(A0, B0)8: return Z2 · 2n + Z1 · 2
n2 + Z0
O(1)O(1)O(n)O(n)T(n2 )2T(n2 )+O(n)T(n2 )O(n)
We get the following recurrence:
T(n) = 4T(n
2
)+O(n) .
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 53/596
![Page 119: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/119.jpg)
Example: Multiplying Two Integers
Algorithm 3 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z1 ←mult(A1, B0)+mult(A0, B1)7: Z0 ←mult(A0, B0)8: return Z2 · 2n + Z1 · 2
n2 + Z0
O(1)O(1)O(n)O(n)T(n2 )2T(n2 )+O(n)T(n2 )O(n)
We get the following recurrence:
T(n) = 4T(n
2
)+O(n) .
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 53/596
![Page 120: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/120.jpg)
Example: Multiplying Two Integers
Master Theorem: Recurrence: T[n] = aT(nb )+ f(n).ñ Case 1: f(n) = O(nlogb a−ε) T(n) = Θ(nlogb a)ñ Case 2: f(n) = Θ(nlogb a logkn) T(n) = Θ(nlogb a logk+1n)ñ Case 3: f(n) = Ω(nlogb a+ε) T(n) = Θ(f (n))
In our case a = 4, b = 2, and f(n) = Θ(n). Hence, we are in
Case 1, since n = O(n2−ε) = O(nlogb a−ε).
We get a running time of O(n2) for our algorithm.
⇒ Not better then the “school method”.
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 54/596
![Page 121: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/121.jpg)
Example: Multiplying Two Integers
Master Theorem: Recurrence: T[n] = aT(nb )+ f(n).ñ Case 1: f(n) = O(nlogb a−ε) T(n) = Θ(nlogb a)ñ Case 2: f(n) = Θ(nlogb a logkn) T(n) = Θ(nlogb a logk+1n)ñ Case 3: f(n) = Ω(nlogb a+ε) T(n) = Θ(f (n))
In our case a = 4, b = 2, and f(n) = Θ(n). Hence, we are in
Case 1, since n = O(n2−ε) = O(nlogb a−ε).
We get a running time of O(n2) for our algorithm.
⇒ Not better then the “school method”.
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 54/596
![Page 122: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/122.jpg)
Example: Multiplying Two Integers
Master Theorem: Recurrence: T[n] = aT(nb )+ f(n).ñ Case 1: f(n) = O(nlogb a−ε) T(n) = Θ(nlogb a)ñ Case 2: f(n) = Θ(nlogb a logkn) T(n) = Θ(nlogb a logk+1n)ñ Case 3: f(n) = Ω(nlogb a+ε) T(n) = Θ(f (n))
In our case a = 4, b = 2, and f(n) = Θ(n). Hence, we are in
Case 1, since n = O(n2−ε) = O(nlogb a−ε).
We get a running time of O(n2) for our algorithm.
⇒ Not better then the “school method”.
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 54/596
![Page 123: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/123.jpg)
Example: Multiplying Two Integers
Master Theorem: Recurrence: T[n] = aT(nb )+ f(n).ñ Case 1: f(n) = O(nlogb a−ε) T(n) = Θ(nlogb a)ñ Case 2: f(n) = Θ(nlogb a logkn) T(n) = Θ(nlogb a logk+1n)ñ Case 3: f(n) = Ω(nlogb a+ε) T(n) = Θ(f (n))
In our case a = 4, b = 2, and f(n) = Θ(n). Hence, we are in
Case 1, since n = O(n2−ε) = O(nlogb a−ε).
We get a running time of O(n2) for our algorithm.
⇒ Not better then the “school method”.
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 54/596
![Page 124: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/124.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 55/596
![Page 125: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/125.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 55/596
![Page 126: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/126.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 55/596
![Page 127: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/127.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 55/596
![Page 128: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/128.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,
Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 55/596
![Page 129: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/129.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 55/596
![Page 130: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/130.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
O(1)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 55/596
![Page 131: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/131.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
O(1)O(1)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 55/596
![Page 132: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/132.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
O(1)O(1)O(n)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 55/596
![Page 133: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/133.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
O(1)O(1)O(n)O(n)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 55/596
![Page 134: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/134.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
O(1)O(1)O(n)O(n)T(n2 )
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 55/596
![Page 135: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/135.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
O(1)O(1)O(n)O(n)T(n2 )2T(n2 )+O(n)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 55/596
![Page 136: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/136.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
O(1)O(1)O(n)O(n)T(n2 )2T(n2 )+O(n)T(n2 )
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 55/596
![Page 137: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/137.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
O(1)O(1)O(n)O(n)T(n2 )2T(n2 )+O(n)T(n2 )O(n)
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 55/596
![Page 138: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/138.jpg)
Example: Multiplying Two Integers
We get the following recurrence:
T(n) = 3T(n
2
)+O(n) .
Master Theorem: Recurrence: T[n] = aT(nb )+ f(n).ñ Case 1: f(n) = O(nlogb a−ε) T(n) = Θ(nlogb a)ñ Case 2: f(n) = Θ(nlogb a logkn) T(n) = Θ(nlogb a logk+1n)ñ Case 3: f(n) = Ω(nlogb a+ε) T(n) = Θ(f (n))
Again we are in Case 1. We get a running time of
Θ(nlog2 3) ≈ Θ(n1.59).
A huge improvement over the “school method”.
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 56/596
![Page 139: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/139.jpg)
Example: Multiplying Two Integers
We get the following recurrence:
T(n) = 3T(n
2
)+O(n) .
Master Theorem: Recurrence: T[n] = aT(nb )+ f(n).ñ Case 1: f(n) = O(nlogb a−ε) T(n) = Θ(nlogb a)ñ Case 2: f(n) = Θ(nlogb a logkn) T(n) = Θ(nlogb a logk+1n)ñ Case 3: f(n) = Ω(nlogb a+ε) T(n) = Θ(f (n))
Again we are in Case 1. We get a running time of
Θ(nlog2 3) ≈ Θ(n1.59).
A huge improvement over the “school method”.
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 56/596
![Page 140: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/140.jpg)
Example: Multiplying Two Integers
We get the following recurrence:
T(n) = 3T(n
2
)+O(n) .
Master Theorem: Recurrence: T[n] = aT(nb )+ f(n).ñ Case 1: f(n) = O(nlogb a−ε) T(n) = Θ(nlogb a)ñ Case 2: f(n) = Θ(nlogb a logkn) T(n) = Θ(nlogb a logk+1n)ñ Case 3: f(n) = Ω(nlogb a+ε) T(n) = Θ(f (n))
Again we are in Case 1. We get a running time of
Θ(nlog2 3) ≈ Θ(n1.59).
A huge improvement over the “school method”.
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 56/596
![Page 141: 6.2 Master Theorem · 6.2 Master Theorem We prove the Master Theorem for the case that nis of the form b‘, and we assume that the non-recursive case occurs for problem size 1 and](https://reader034.vdocuments.mx/reader034/viewer/2022051918/600b086167a29a4eb23b4762/html5/thumbnails/141.jpg)
Example: Multiplying Two Integers
We get the following recurrence:
T(n) = 3T(n
2
)+O(n) .
Master Theorem: Recurrence: T[n] = aT(nb )+ f(n).ñ Case 1: f(n) = O(nlogb a−ε) T(n) = Θ(nlogb a)ñ Case 2: f(n) = Θ(nlogb a logkn) T(n) = Θ(nlogb a logk+1n)ñ Case 3: f(n) = Ω(nlogb a+ε) T(n) = Θ(f (n))
Again we are in Case 1. We get a running time of
Θ(nlog2 3) ≈ Θ(n1.59).
A huge improvement over the “school method”.
EADS 6.2 Master Theorem
c© Ernst Mayr, Harald Räcke 56/596