

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


ECS 122A: Algorithm Design and Analysis Homework 1 UC Davis: Charles Martel, Susan Margulies Due Monday, April 14, 2008, 4 PM
marked box in K ĀÆ
emper Hall, room 2131 (right side). No late homeworks will be accepted.
Much of what one learns in this course comes from trying to solve the homework problems, so work hard on them. Doing a conscientious job on the homeworks is the best preparation for the exams. We hope that you will ultimately solve the majority of the problems, but donāt be surprised if some of them stump you; some of the problems may be quite challenging.
Your solutions should be terse, correct, and legible. Understandability of the solution is as necessary as correctness. Expect to lose points if you provide a ācorrectā solution with a not-so-good writeup. As with an English paper, you canāt expect to turn in a first draft: it takes refinement to describe something well. Typeset solutions are always appreciated.
If you canāt solve a problem, briefly indicate what youāve tried and where the difficulty lies. Donāt try to pull one over on us.
If you think a problem was misgraded, please see the grader first. (The TA will be the grader for the homework).
We claimed in lecture that the stable marriage algorithm could be implemented to run in O(n^2 ) time. Describe data structures which will allow this run time. In particular you should describe how to store the preference lists, the current marriage, and the men who are unpaired.
Justify that each proposal now takes O(1) time.
2 ECS 122A Handout 1: Problem Set 1
One of the following statements is true. Say which one and prove it.
a. If a directed graph G has k strongly connected components, by adding one more edge to G, the number of strongly connected components can drop at most by 1 (i.e the new graph obtained from G by adding one edge has at least k ā 1 strongly connected components).
b. For every k, there exists a graph G that has k strongly connected components and such that if we add one particular edge to G, we can make it be strongly connected (i.e. the new graph has only 1 strongly connected component).
In an undirected graph with 2 connected components it is always possible to make the graph con- nected by adding only one edge. Give an example of a directed graph with two strongly connected components such that no addition of one edge can make the graph be strongly connected.