CS 473
Homework 0 (due January 27, 2009)
Spring 2009
CS 473: Undergraduate Algorithms, Spring 2009
Homework 0
Due
in class
at 11:00am, Tuesday, January 27, 2009
•
This homework tests your familiarity with prerequisite material—bigOh notation, elementary
algorithms and data structures, recurrences, graphs, and most importantly, induction—to help
you identify gaps in your background knowledge.
You are responsible for filling those gaps.
The early chapters of any algorithms textbook should be sufficient review, but you may also want
consult your favorite discrete mathematics and data structures textbooks. If you need help, please
ask in office hours and
/
or on the course newsgroup.
•
Each student must submit individual solutions for this homework. For all future homeworks,
groups of up to three students may submit a single, common solution.
•
Please carefully read the course policies linked from the course web site. If you have
any
questions,
please ask during lecture or office hours, or post your question to the course newsgroup. In
particular:
–
Submit five separately stapled solutions, one for each numbered problem, with your name
and NetID clearly printed on each page. Please do not staple everything together.
–
You may use any source at your disposal—paper, electronic, or human—but you
must
write
your solutions in your own words, and you
must
cite every source that you use.
–
Unless explicitly stated otherwise,
every
homework problem requires a proof.
–
Answering “I don’t know” to any homework or exam problem (except for extra credit
problems) is worth 25% partial credit.
–
Algorithms or proofs containing phrases like “and so on” or “repeat this process for all
n
”,
instead of an explicit loop, recursion, or induction, will receive 0 points.
Write the sentence “I understand the course policies." at the top of your solution to problem 1.
1.
Professor George O’Jungle has a 27node binary tree, in which every node is labeled with a unique
letter of the Roman alphabet or the character
&
. Preorder and postorder traversals of the tree visit
the nodes in the following order:
•
Preorder:
I Q J H L E M V O T S B R G Y Z K C A & F P N U D W X
•
Postorder:
H E M L J V Q S G Y R Z B T C P U D N F W & X A K O I
(a) List the nodes in George’s tree in the order visited by an inorder traversal.
(b) Draw George’s tree.
1
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
CS 473
Homework 0 (due January 27, 2009)
Spring 2009
2.
(a)
[
5 pts
]
Solve the following recurrences. State tight asymptotic bounds for each function in
the form
Θ(
f
(
n
))
for some recognizable function
f
(
n
)
. Assume reasonable but nontrivial base
cases. If your solution requires a particular base case, say so.
Do not submit proofs
—just a
list of five functions—but you should do them anyway, just for practice.
A
(
n
) =
10
A
(
n
/
5
) +
n
B
(
n
) =
2
B
n
+
3
4
+
5
n
6
/
7

8
r
n
log
n
+
9
log
10
n

11
C
(
n
) =
3
C
(
n
/
2
) +
C
(
n
/
3
) +
5
C
(
n
/
6
) +
n
2
D
(
n
) =
max
0
<
k
<
n
(
D
(
k
) +
D
(
n

k
) +
n
)
E
(
n
) =
E
(
n

1
)
E
(
n

3
)
E
(
n

2
)
[Hint: Write out the first 20 terms.]
(b)
[
5 pts
]
Sort the following functions from asymptotically smallest to asymptotically largest,
indicating ties if there are any.
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '08
 Chekuri,C
 Algorithms, Graph Theory, Analysis of algorithms

Click to edit the document details