Docsity

MST - Advanced Data Structures and Algorithms - Exam, Exams of Data Structures and Algorithms

Toggle sidebar
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.
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.
CS 542 โ€“ Advanced Data Structures and Algorithms
Exam 1
Jonathan Turner 2/20/2012
pf3
pf4
pf5
pf8

Partial preview of the text

Download MST - Advanced Data Structures and Algorithms - 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. 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.

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? Show the heap that results from performing a deletemin on the heap. How many credits are needed to maintain the invariant following the deletemin? r (^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 ! ! (^)!! !
  1. (20 points) Consider the problem of finding a maximum weight subgraph of an edge- weighted graph, in which each vertex has degree โ‰ค k for some given value of k. List the edges in such a subgraph for the example graph shown below, for the case k =2. Describe an efficient method for solving this problem in the case of bipartite graphs. Be precise and complete. Illustrate your method using the graph shown below, for the case k =2. What is the asymptotic running time for an implementation of your method?

a

c

d^ b

f

e

a c b d f e 8 2 5 3 6 7 9 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.
  1. ( 10 points) The figure shown below is a 2-left hash table with buckets of size 4 and a separate ( key , value ) table. What value is returned if we do a lookup on a key x where hash 1 (x ) returns a bucket index of 1 and a fingerprint of 17 and hash 2 ( x ) returns a bucket index of 3 and a fingerprint of 5 3? Assume that there are no false fingerprint matches. Show how the hash table changes following an insert of the ( key , value ) pair (13,20). Assume that the new entry is placed in the first unused entry in the ( key , value ) table and that the hash 1 (13) returns a bucket index of 2 and a fingerprint of 19, while hash 2 (13) returns a bucket index of 0 and a fingerprint of 23. 0 1 3,20 13, 2 (^3) 1,41 5, (^4) 9, (^0) 10, (^1) 2,30 0, (^2) 7, (^3) 12,51 15, 4 13,40 11, key value 0 2 20 (^1 3 ) (^2 5 ) (^3 7 ) 4 (^5 11 ) 6 (^7 39 ) 8 (^9 17 ) (^10 19 ) (^11 23 ) (^12 29 ) 13 31 31 14 15 37 32 hash 1 () hash 2 () key-value table index, fingerprint
  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. 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 s a c b d e f 1 4

3 4 5 4 3 (^6 )

queue : parent pointer