CS180 Winter 2011
Homework 2
The following homework is due Wednesday, January 19 at the beginning of lecture.
When submitting your homework, please include your name at the top of each page. If you submit
multiple pages, please staple them together. We also ask that you do something to indicate which
name is your last name on the ﬁrst page, such as underlining it.
Please provide complete arguments and time complexity analysis for all solutions,
unless otherwise stated.
1. Give an algorithm for ﬁnding the diameter of a undirected tree using 2 BFSs. Prove the
correctness of your algorithm.
. (You will get 20% score for saying “I don’t know!” But you
will get zero points for writing arguments which are almost completely wrong.)
2. Give an algorithm to ﬁnd the longest directed hopcount path in a DAG (directed acyclic
graph).
3. Give an algorithm that pairs up odd degree nodes of a tree such that the nodes in these pairs
are connected by paths that are edge disjoint.
3.4 from textbook
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 04/16/2011 for the course CS 180 taught by Professor Moloudi during the Spring '08 term at UCLA.
 Spring '08
 MOLOUDI

Click to edit the document details