Docsity

Master Method: Bounding Recurrences using the Master Theorem, Assignments of Computer Science

Toggle sidebar
bg1
cs141 Workshop: The Master Method
The Master Theorem:
Let
a≥ and b be constants, let 1 1>
(
)
f
n be a function, and let Tn be defined
on the nonnegative integers by the recurrence:
()
(
)
(
)
(
)
/Tn aTnb f n=+
,
where we interpret n to mean either /b/nb
or /nb
. Then
(
)
Tn can be bounded
asymptotically as follows:
1. If
fn
()
(
logba
n
)
ε
−
=Ο for some constant 0
ε
>, then
(
)
(
)
logba
n=ΘTn .
2. If
()
(
log log
bak
)
f
nn=Θ nfor some constant , then 0k≥
(
)
()
log 1
log
bak
Tn n n
+
=Θ .
3. If
fn
()
(
logba
n
)
ε
+
=Ω for some constant 0
>, and if
(
)(
/n b cf n≤
)
af for some
constant c and all sufficiently large n, then 1<
(
)
(
)
(
)
fn=ΘTn .
Use the master method (where applicable) to solve the following recurrence
relations:
Assume that Tn is constant for
()
2n
≤
.
1.
() ( )
3
2/2Tn Tn n=+
2.
() ( )
9/10Tn T n n=+
3.
()
(
)
2
16 / 4Tn Tn n=+
4.
() ( )
2
7/3Tn Tn n=+
5.
() ( )
2
7/2Tn Tn n=+
6.
() ( )
2/4Tn Tn n=+
7.
() ( )
1Tn Tn n=−+
8.
()
()
1Tn T n=+
9.
() ( )
3/2 lgTn Tn n n=+
10.
() ( )
3/35 /Tn Tn n=++2
11.
()
2/2 /lgTn n n+
12.
() ( )
11/Tn Tn n=−+
13.
() ( )
1lgTn Tn n=−+
14.
()
()
Tn nT n n=+
15.
() ( )
3/4Tn Tn n=+
16.
() ( )
2/2Tn Tn n=+
2
17.
() ( )
4/2Tn Tn n=+

Partial preview of the text

Download Master Method: Bounding Recurrences using the Master Theorem and more Assignments Computer Science in PDF only on Docsity!

cs141 Workshop: The Master Method

The Master Theorem:

Let a ≥ 1 and b > 1 be constants, let

f n be a function, and let T n be defined

on the nonnegative integers by the recurrence:

T n = aT n b / + f n ,

where we interpret n / b to mean either n b /  

 

or n b /  

 

. Then

T n can be bounded

asymptotically as follows:

  1. If f n

log

b

a

n

− ε

= Ο for some constant ε > 0 , then

log

b

a

T n = Θ n.

  1. If

log

log

b

a k

f n = Θ n n for some constant k ≥ 0 , then

log 1

log

b

a k

T n n n

  1. If f n

log

b

a

n

  • ε

= Ω for some constant ε > 0 , and if

n b / ≤ cf n

af for some

constant c < 1 and all sufficiently large n , then

T n = Θ f n.

Use the master method (where applicable) to solve the following recurrence

relations:

Assume that T n is constant for

n ≤ 2.

3

T n = 2 T n / 2 + n

T n = T 9 n /10 + n

2

T n = 16 T n / 4 + n

2

T n = 7 T n / 3 + n

2

T n = 7 T n / 2 + n

T n = 2 T n / 4 + n

T n = T n − 1 + n

T n = T n + 1

T n = 3 T n / 2 + n lg n

T n = 3 T n / 3 + 5 + n / 2

2 T n / 2 + n / lg n

T n = T n − 1 +1/ n

T n = T n − 1 +lg n

T n = nT n + n

T n = 3 T n / 4 + n

T n = 2 T n / 2 + n

2

T n = 4 T n / 2 + n