Algorithm Design and Analysis: Homework 4 - Minimum Spanning Trees and Recurrences, Assignments of Computer Science

A handout for homework 4 in the algorithm design and analysis course at pennsylvania state university, cse 565, fall 2008. It includes exercises on minimum spanning trees with negative-weight edges, recursion-tree method for solving recurrences, and minimum spanning tree algorithms for large input with limited workspace.

Typology: Assignments

Pre 2010

Uploaded on 09/24/2009

koofers-user-oip
koofers-user-oip 🇺🇸

8 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Algorithm Design and Analysis September 20, 2008
Pennsylvania State University CSE 565, Fall 2008
Adam Smith Handout 6
Homework 4 Due Friday, September 26, 2008
Please refer to the general information handout for the full homework policy and options.
Reminders
Your solutions are due before the lecture. Late homework will not be accepted.
Collaboration is permitted, but you must write the solutions by yourself without assistance,
and be ready to explain them orally to a member of the course staff if asked. You must also
identify your collaborators. Getting solutions from outside sources such as the Web or students
not enrolled in the class is strictly forbidden.
To facilitate grading, please write down your solution to each problem on a separate sheet of
paper. Make sure to include all identifying information and your collaborators on each sheet.
Your solutions to different problems will be graded separately, possibly by different people, and
returned to you independently of each other.
For problems that require you to provide an algorithm, you must give a precise description of
the algorithm, together with a proof of correctness and an analysis of its running time.
You may use algorithms from class as subroutines. You may also use any facts that we proved
in class or from the book.
Exercises These should not be handed in, but the material they cover may appear on exams:
1. Exercises in Chapter 4.
2. (MST with negative-weight edges) Give a O(mlog n) algorithm which takes as input a connected,
undirected graph G= (V, E ) and distinct weights w,some of which may be negative, and outputs
a minimum spanning subgraph FE, i.e. it outputs a set of edges Fsuch that (V, F ) is
connected and PeFweis minimized. Note that Fneed not be a tree.
3. Suppose Gis a connected, undirected graph in which all edge weights weare positive and distinct.
Consider the graph G0with the same vertices and edges as G, but with edge weights w0
e=w2
e+6.
Prove or disprove: For every pair of vertices uand v, the shortest path from uto vis the same
in Gas in G0.
4. Suppose Gand G0are as above. Prove or disprove: The minimum spanning tree of G0is the
same as the minimum spanning tree of G.
Problems to be handed in
Page limits: The answer to each problem should fit in 2 pages (or one double-sided sheet) of
paper. Longer answers will be penalized.
1
pf2

Partial preview of the text

Download Algorithm Design and Analysis: Homework 4 - Minimum Spanning Trees and Recurrences and more Assignments Computer Science in PDF only on Docsity!

Algorithm Design and Analysis September 20, 2008

Pennsylvania State University CSE 565, Fall 2008

Adam Smith Handout 6

Homework 4 – Due Friday, September 26, 2008

Please refer to the general information handout for the full homework policy and options.

Reminders

  • Your solutions are due before the lecture. Late homework will not be accepted.
  • Collaboration is permitted, but you must write the solutions by yourself without assistance, and be ready to explain them orally to a member of the course staff if asked. You must also identify your collaborators. Getting solutions from outside sources such as the Web or students not enrolled in the class is strictly forbidden.
  • To facilitate grading, please write down your solution to each problem on a separate sheet of paper. Make sure to include all identifying information and your collaborators on each sheet. Your solutions to different problems will be graded separately, possibly by different people, and returned to you independently of each other.
  • For problems that require you to provide an algorithm, you must give a precise description of the algorithm, together with a proof of correctness and an analysis of its running time. You may use algorithms from class as subroutines. You may also use any facts that we proved in class or from the book.

Exercises These should not be handed in, but the material they cover may appear on exams:

  1. Exercises in Chapter 4.
  2. (MST with negative-weight edges) Give a O(m log n) algorithm which takes as input a connected, undirected graph G = (V, E) and distinct weights w, some of which may be negative, and outputs a minimum spanning subgraph F ⊂ E, i.e. it outputs a set of edges F such that (V, F ) is connected and

e∈F we^ is minimized. Note that^ F^ need not be a tree.

  1. Suppose G is a connected, undirected graph in which all edge weights we are positive and distinct. Consider the graph G′^ with the same vertices and edges as G, but with edge weights w′ e = w e^2 +6. Prove or disprove: For every pair of vertices u and v, the shortest path from u to v is the same in G as in G′.
  2. Suppose G and G′^ are as above. Prove or disprove: The minimum spanning tree of G′^ is the same as the minimum spanning tree of G.

Problems to be handed in

Page limits: The answer to each problem should fit in 2 pages (or one double-sided sheet) of paper. Longer answers will be penalized.

  1. (Recursion-Tree Method) Use the recursion-tree method to solve the following recurrences. Express your answer using Θ-notation. Note: It may help to review sums of geometric and arithmetic progressions (e.g. sums like

∑n i=1 ri^ or^

∑n i=1 i.) (a) T (n) = 7T (n/2) + cn, where c ≥ 0 is a constant. (b) T (n) = T (n − 1) + c log^2 (n), where c ≥ 0 is a constant. (c) T (n) = T (n/5) + 4T (4n/5) + cn, where c ≥ 0 is a constant.

  1. (MST)

(a) Suppose G is a connected, undirected graph in which all edge weights we are positive but not necessarily distinct. Let S ⊂ V be a cut in the graph, and let ES be the set of least- weight edges with exactly one endpoint in S (there may be several such edges since edge weights are not distinct). Prove or disprove: for every edge e in ES , there exists a minimum spanning tree T for G containing e. (b) KT, Chapter 4, Problem 19 (bottlenecks).

  1. (Space-Efficient Algorithms for the MST) You are designing a MST algorithm that runs on a machine with a large input but very small workspace. The input to your algorithm is an undirected graph presented in the following form: an integer n = |V |, followed by a list of m edges along with their weights, that is, a list of triples (u, v, wuv), where u, v ∈ { 1 , ..., n} and wuv > 0. Give an algorithm which makes a single pass through the list of edges, using only O(n) space, and outputs a minimum spanning tree at the end of its pass. Your algorithm should work no matter what order the edges are listed in. (Hint: as you pass through the input, maintain a tree; as each new edge is considered, decide whether or not to add it to your tree and, if necessary, which edges from the current tree to discard). You may assume that the graph is connected and that all edge weights are distinct. Remember to prove the correctness of your algorithm and discuss its running time.
  2. *(Extra credit) Give an algorithm for the previous problem that uses O(n log n) space and O((m + n) log n) total time.

Note on the motivation for this model: Data sets are often too large to fit into main memory. For example, AT&T’s phone call graph has millions of vertices (users) and trillions of edges (phone calls). Storing a spanning tree for such a graph would require only megabytes of space, whereas storing all edge of the graph requires terabytes! The algorithms you are asked to design here use a small amount of main memory to process a large secondary memory via a single pass. Alternatively, you can think of edges arriving in real time (say, as phone calls are made), and the system keeping track only of the MST of the graph rather than all its edges.