Mehran Sahami
Handout #16
CS103B
February 2, 2009
Problem Set #3
Due: 11:00am on Wednesday, February 11th
Note: in the problems below in which you are asked for a bigOh running time, we are looking
for a
tight
bigOh bound (analogous to the bigTheta (
) notation mentioned in class and in
Handout #9), but you only need to show the upper bound (bigOh).
You do not need to show the
lower bound.
1.
In Handout #11, we concluded that the recurrence relation for the running time of the
recursive
Binary search
algorithm is (using constants x and y here):
T(1) = x
T(n) = T(n/2) + y
Determine the bigOh running time for this recurrence relations using:
a.
Repeated substitution.
Use induction to prove that your closed form formula for T(n) is
correct.
b.
Theorem 1 (Master Theorem) from Handout #10.
Show how you got your result by
explicitly stating the values of a, b, c, and d from the Theorem in terms of this recurrence,
and how you computed the final bigOh as a result.
2.
Consider the number of permutations of a set with
n
elements.
a.
Find a recurrence relation for the number of permutations of a set with
n
elements.
Make
sure to explain how you came up with this recurrence.
b.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Winter '08
 SAHAMI,M
 Recursion, Big O notation, Computational complexity theory, Recurrence relation

Click to edit the document details