Docsity

Mathematics for Computer Science Problem Set 8, Exercises of Applied Mathematics

Toggle sidebar
bg1
� �
6.042/18.062J Mathematics for Computer Science October 28, 2010
Tom Leighton and Marten van Dijk
Problem Set 8
Problem 1. [25 points] Find Θ bounds for the following divide-and-conquer recurrences.
Assume T (1) = 1 in all cases. Show your work.
(a) [5 pts] T (n) = 8T (�n/2�) + n
(b) [5 pts] T (n) = 2T (�n/8� + 1/n) + n
(c) [5 pts] T (n) = 7T (�n/20�) + 2T (�n/8�) + n
(d) [5 pts] T (n) = 2T (�n/4� + 1) + n1/2
(e) [5 pts] T (n) = 3T ( n/9 + n1/9 ) + 1
Problem 2. [30 points] It is easy to misuse induction when working with asymptotic
notation.
False Claim If
T (1) = 1 and
T (n) = 4T (n/2) + n
Then T(n) = O(n).
False Proof We show this by induction. Let P (n) be the proposition that T (n) = O(n).
Base Case: P (1) is true because T (1) = 1 = O(1).
Inductive Case: For n ≥ 1, assume that P (n − 1), . . . , P (1) are true. We then have that
T (n) = 4T (n/2) + n = 4O(n/2) + n = O(n)
And we are done.
(a) [5 pts] Identify the flaw in the above proof.
pf3

Partial preview of the text

Download Mathematics for Computer Science Problem Set 8 and more Exercises Applied Mathematics in PDF only on Docsity!

6.042/18.062J Mathematics for Computer Science October 28, 2010

Tom Leighton and Marten van Dijk

Problem Set 8

Problem 1. [25 points] Find Θ bounds for the following divide-and-conquer recurrences.

Assume T (1) = 1 in all cases. Show your work.

(a) [5 pts] T (n) = 8T (�n/ 2 �) + n

(b) [5 pts] T (n) = 2T (�n/ 8 � + 1/n) + n

(c) [5 pts] T (n) = 7T (�n/ 20 �) + 2T (�n/ 8 �) + n

(d) [5 pts] T (n) = 2T (�n/ 4 � + 1) + n^1 /^2

(e) [5 pts] T (n) = 3T ( n/9 + n^1 /^9 ) + 1

Problem 2. [30 points] It is easy to misuse induction when working with asymptotic

notation.

False Claim If

T (1) = 1 and

T (n) = 4T (n/2) + n

Then T(n) = O(n).

False Proof We show this by induction. Let P (n) be the proposition that T (n) = O(n).

Base Case: P (1) is true because T (1) = 1 = O(1).

Inductive Case: For n ≥ 1, assume that P (n − 1),... , P (1) are true. We then have that

T (n) = 4T (n/2) + n = 4O(n/2) + n = O(n)

And we are done.

(a) [5 pts] Identify the flaw in the above proof.

2 Problem Set 8

(b) [10 pts] A simple attempt to prove T (n) = O(n) via induction ultimately fails. We

assume for sake of contradiction that T (n) = O(n). Then there exists positive integer n 0

and positive real number c such that for all n ≥ n 0 , T (n) ≤ cn. We then define P (n) as the

proposition that T (n) ≤ cn.

We then proceed with strong induction.

Base Case, n = n 0 : P (n 0 ) is true, by assumption.

Inductive Step: We assume P (n 0 ), P (n 0 + 1),... , P (n − 1) true.

Fill in the rest of this proof attempt, and explain why it doesn’t work.

Note: As this problem was updated so late, the graders will be instructed to be exceedingly

lenient when grading this.

(c) [5 pts] Using Akra-Bazzi theorem, find the correct asymptotic behavior of this recur

rence.

(d) [10 pts] We have now seen several recurrences of the form T (n) = aT (�n/b�) + n. Some

of them give a runtime that is O(n), and some don’t. Find the relationship between a and

b that yields T (n) = O(n), and prove that this is sufficient.

Problem 3. [15 points] Define the sequence of numbers Ai by

A 0 = 2

An+1 = An/2 + 1/An (for n ≥ 1)

Prove that An ≤

n for all n ≥ 0.

Problem 4. [30 points] Find closed-form solutions to the following linear recurrences.

(a) [15 pts] xn = 4xn− 1 − xn− 2 − 6 xn− 3 (x 0 = 3, x 1 = 4, x 2 = 14)

(b) [15 pts] xn = −xn− 1 + 2xn− 2 + n (x 0 = 5, x 1 = − 4 /9)