You are on page 1of 1

CS/MATH111 ASSIGNMENT 1

due Tuesday, October 21 (2PM)


Individual assignment: Problems 1 and 2.
Group assignment: Problems 1,2 and 3.
Problem 1: Give the exact and asymptotic formula for the number f(n) of letters Z printed by Algo-
rithm PrintZs below. Your solution must consist of the following steps:
(a) First express f(n) using a summation notation

.
(b) Next, give a closed-form formula for f(n).
(c) Finally, give the asymptotic value of the number of Zs (using the -notation.) Include a brief justi-
cation for each step.
Note: If you need any summation formulas for this problem, you are allowed to look them up.
Algorithm PrintZs (n : integer)
for i 1 to 3n + 1 do
for j 1 to i
2
+ 2 do print(Z)
Problem 2: Consider a sequence dened recursively as B
0
= 2, B
1
= 5, and B
n
= 3B
n1
+B
n2
for n 2.
Prove that B
n
= O(3.4
n
) and B
n
= (3.3
n
).
Hint: First, prove by induction that 3.3
n
B
n
2(3.4)
n
for all n 0.
Problem 3: Give the asymptotic values of the following functions, using the -notation:
(a)
1
2
n
5
+ 7n
4
n
3
+ 13n
(b) 3 + 2n
2
+ 1/(log
2
n)
(c) n(7n
3
log n + 9nlog
5
n) + 15n
3
(d) n
2
2
n
+ 13n
4
+ n
3
log n
(e) n
5
3
n
+ n4
n
Justify your answer. (Here, you dont need to give a complete rigorous proof. Give only an informal
explanation using asymptotic relations between the functions n
c
, log n, and c
n
.)
Submission. To submit the homework, you need to upload the pdf le into ilearn by 2PM on Tuesday,
October 21, and turn-in a paper copy in class.
Reminders. Remember that only L
A
T
E
X papers are accepted. Also, remember to turn in your signed
academic integrity statement. (You can scan it and submit via ilearn, turn it in in class, or slip it under my
oce door.)
1

You might also like