Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Maximum Weight - Advanced Data Structures and Algorithms - Solved Exam, Exams of Data Structures and Algorithms

Main points of this past exam are: Algorithms, Minimum Spanning Tree, Advanced Data Structures, Maximum Weight, Minimum Spanning Tree, Vertex Sets, Subtrees Define, Fibonacci Heap, Credit Invariant, Analysis

Typology: Exams

2012/2013

Uploaded on 03/23/2013

sardai
sardai 🇮🇳

4

(10)

117 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
- 1 -
1. (10 points) Suppose you are given an edge-weighted graph G and a minimum spanning tree
T of G. Let {u,v} be an edge in T. If we increase the weight of {u,v}, at some point the cost
may become large enough that T is no longer a minimum spanning tree. Describe (in words)
a method for determining the maximum weight that {u,v} can have before this happens. Be
precise.
If we remove {u,v} from T, it divides into two subtrees. The vertex sets for these subtrees define a cut
on G. Let w be the min weight among all edges in the cut (excluding {u,v}). Then w is the largest
weight we can assign to {u,v} without invalidating T.
Let {u,v} be an edge that is in G, but not in T. If we reduce the weight of this edge, at some
point it may be come small enough that T is no longer a minimum spanning tree. Describe a
method for determining the smallest weight that {u,v} can have while ensuring that T is still
a minimum spanning tree.
Let w be the weight of the maximum weight edge on the path from u to v in the tree T. Then w is the
smallest weight we can assign to edge {u,v} without invalidating T.
CS 542 – Advanced Data Structures and Algorithms
Exam 1
Jonathan Turner 2/20/2012
pf3
pf4
pf5

Partial preview of the text

Download Maximum Weight - Advanced Data Structures and Algorithms - Solved Exam and more Exams Data Structures and Algorithms in PDF only on Docsity!

  1. ( 10 points) Suppose you are given an edge-weighted graph G and a minimum spanning tree T of G. Let { u , v } be an edge in T. If we increase the weight of { u , v }, at some point the cost may become large enough that T is no longer a minimum spanning tree. Describe (in words) a method for determining the maximum weight that { u , v } can have before this happens. Be precise. If we remove {u,v} from T, it divides into two subtrees. The vertex sets for these subtrees define a cut on G. Let w be the min weight among all edges in the cut (excluding {u,v}). Then w is the largest weight we can assign to {u,v} without invalidating T. Let { u , v } be an edge that is in G , but not in T. If we reduce the weight of this edge, at some point it may be come small enough that T is no longer a minimum spanning tree. Describe a method for determining the smallest weight that { u , v } can have while ensuring that T is still a minimum spanning tree. Let w be the weight of the maximum weight edge on the path from u to v in the tree T. Then w is the smallest weight we can assign to edge {u,v} without invalidating T.

CS 542 – Advanced Data Structures and Algorithms

Exam 1

Jonathan Turner 2/20/

  1. ( 15 points ) In the Fibonacci heap shown below, the numbers are the key values. How many credits are needed to ensure that the credit invariant used in the amortized analysis is satisfied? 6 + 2×5 = 16 Show the heap that results from performing a deletemin on the heap. How many credits are needed to maintain the invariant following the deletemin? 1 + 2×3 = 7 b (^3) b 0 a 4 q n 6 f 7 o h i 9 k j l m g p e 7 4 2 5 3 8 6 7 6 1 d 4 ! ! (^)!! !

b

a

n^ q

f

o

h

i

k j

l

g

p

m

e

d

!^4

  1. ( 10 points) In the shortest augmenting path algorithm for the maximum flow problem, different steps may add flow to an edge in opposite directions. Give an upper bound on the number of times that the flow on a given edge can be reversed. Make the bound as tight as you can. Explain your answer. Hint: divide the execution of the algorithm into phases, where a phase ends every time the number of edges in a shortest augmenting path increases. If we divide the execution into phases, within each phase, an edge (u,v) can only be used in one direction. This is implied by the proof of the lemma that shows that the distance from the source to the sink increases by at least 1 after every m augmenting path steps. So, the maximum number of reversals is one less than the maximum number of phases or n-1.
  1. (20 points) Suppose you are given min-cost maximum flow f on a flow graph G. Now, suppose that we decrease the cost of the edge e =( u , v ) by some amount. This may result in f no longer being a min-cost flow. Describe (precisely and completely) a method to determine the smallest cost that we can assign to e without invalidating f. Note that for some values of f ( u , v ), we can make cost ( u,v ) arbitrarily small, without invalidating f. Be sure to identify any such cases when describing your method. If we decrease cost(u,v) enough to create a negative cycle, then f will no longer by a min-cost flow. So, let c be the cost of a min-cost path from v to u in the residual graph for f that does not use (v,u). Then the smallest cost we can assign to cost(u,v) is - c. If f(u,v)=cap(u,v), then (u,v) is not in the residual graph for f. In this case we can decrease cost(u,v) arbitrarily without creating a negative cycle. Suppose that instead of decreasing cost ( u , v ) we increase it. Describe a method to determine the largest cost we can assign, without invalidating f. Be sure to identify any values of f ( u , v ) for which the cost ( u , v ) can be made arbitrarily large. If we increase cost(u,v) enough to create a negative cycle involving (v,u), then f will no longer by a min-cost flow. So, let c be the cost of a min-cost path from u to v in the residual graph for f that does not use (u,v). Then the largest cost we can assign to cost(u,v) is c (or equivalently, the smallest cost we can assign to cost(v,u) is - c). If f(u,v)=0, then (u,v) is not in the residual graph for f. In this case we can decrease cost(u,v) arbitrarily without creating a negative cycle.
  1. ( 15 points) In the analysis of the breadth-first scanning algorithm for shortest paths, we divided the execution of the algorithm into phases. The figure below shows the state of the algorithm on a graph, after phase number 1 has completed. Show the state of the algorithm after phase 2 has completed, using the second copy of the graph that is provided. Be sure to show the queue, the parent pointers and all the dist () values. In a graph with 1,000 vertices and 5,000 edges, what is the maximum number of times that examination of the specific edge ( u , v ) can cause dist ( v ) to change? Explain why. edge (u,v) can be examined at most once per phase (since u is scanned at most once per phase). Since there are at most n phases, the answer is 1,000 in this case. s a c b d e f 1 4

3 4 5 4 3 (^6 )

queue : b , d , e dist ( c )= 0 3 10 6 7 parent pointer s a c b d e f 1 4

3 4 5 4 3 (^6 )

queue : f, b dist ( c )= 0 10 5 parent pointer (^34) 5