Method of Unrolling
Consider the following inductively defined function:
T
(1) = 1
n
2,
T
(
n
) =
T
(
n
1) + 3
n
Claim:
T
(
n
)
is
O
(
n
2
)
roof:
Suppose
very large Then
Proof:
n
is very large. Then
T
(
n
)=
T
(
n
1) + 3
n
(by definition)
=
T
(
n
2) + 3((
n
1) +
n
)
=
T
(
n
3) + 3((
n
2) + (
n
1) +
n
)
…
=
) + 3(2 + 3 + … + (
) + (
) +
T
(1)
3(2
3
…
(
n
2)
(
n
1)
n
)
=
hich is
)
1
(
2
3
1
2
)
1
(
3
1
1
3
1
3
1
n
n
n
n
i
i
n
n
which is
O
(
n
2
)
1
2
i
i
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentMethod of Unrolling: Another example
Consider the following inductively defined function:
M
(0) =
p
n
2,
M
(
n
) = (1.05)
M
(
n
1)
Claim:
T
(
n
)
is
O
(1.05
n
)
roof:
Suppose
very large Then
Proof:
n
is very large. Then
M
(
n
)
=
(1.05)
M
(
n
1)
(by definition)
=
(1.05)
2
M
(
n
2)
=
(1.05)
3
M
(
n
3)
…
=
(1.05)
n
)
M
(0)
=
(1.05)
n
p
hich is
05
which is
O
(1.05
n
)
Sample proofs with Big O
We have just shown that
M
(
n
)
is
O
(1.05
n
)
Claim 1:
M
(
n
)
is
O
(2
n
)
Proof 1:
Since
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '10
 fleck
 Following, Philosophy of language

Click to edit the document details