v22.0310-003: Homework 2
Due date: Wed Oct 6.
This homework has a programming part and
a written part. The programming part should
be submitted as usual by email.
The written part must be handed in either
after the lectures on Wednesday, OR to the TA during
his office hours on Wednesay.
Here are
additional information since the original posting of
assignment:
-
The following recurrence actually
arise in the analysis of a famous fast
algorithm for multiplying binary numbers:
T(x) = 3 T (x/2) + x
if x > 1;
otherwise T(x) = 0.
Prove that T(x) = Theta(x^c)
where c=lg 3 (approximately 1.585).
HINT: since we already tell you the correct answer, you can
just use induction directly. Remember that a
Theta bound should be broken up into two parts.
-
Use real induction to give an exact solution
for the following recurrence on real numbers:
T(x) = 2 T (x/2) + x
if x > 1;
otherwise T(x) = 1.
Note that only difference from our
lecture example is that the
initial condition.
-
Problem 3.8 (Chapter 3, page 72) of
the text book. It says ``briefly explain'',
which we will interprete to mean that you show
the implicit constants in the big-Oh, big-Omega
or big-Theta.
[Note: if a pair of functions
are big-Omega of each other, then you must
show a big-Omega result to get full credit.]
-
In the file
node.java
we have designed a
nodeInterface interface.
You must give a complete implementation
of this interface by defining a
class called
node.
We have started this implementation
process by providing you with a
skeleton class. Please fill in all
the remaining details. You are not
allowed to modify any details we have
specified.
We have also specified
the functionality we expect
in your main method.
We have written two methods for you,
both having to do with
DataInputStream
and/or
FileInputStream. These
are two important topics that will help
you in doing other problems -- so you should
read this code carefully
and understand what its doing.