Prim Algorithm - Advanced Data Structures and Algorithms - Exam, Exams of Data Structures and Algorithms

Main points of this exam paper are: Advanced Data Structures, Prim's Algorithm, Minimum Spanning Tree, Implicitly Colors, Edge Weights, General Greedy Method, Prim's Algorithm, Spanning Trees, Changkey, Siftdown Procedure

Typology: Exams

2012/2013

Uploaded on 03/23/2013

saruy
saruy 🇮🇳

4.5

(120)

130 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
- 1 -
1. (10 points) Prim’s algorithm can be viewed as applying the blue rule of the general greedy
method n–1 times to create a minimum spanning tree. It then implicitly colors the remaining
edges red without ever considering their edge weights. Explain why this last step is
consistent with the general greedy method.
Suppose an application uses Prim’s algorithm for minimum spanning trees and we happen
to know that for the graphs that arise in the application, changkey is called at most n4/3 times.
Based on this, derive an estimate for the best choice of d for this application. How many
levels will the heap have if n=106?
CS 542 – Advanced Data Structures and Algorithms
Exam 1
J
onathan Turne
r
2/18/2010
pf3
pf4
pf5

Partial preview of the text

Download Prim Algorithm - Advanced Data Structures and Algorithms - Exam and more Exams Data Structures and Algorithms in PDF only on Docsity!

  1. (10 points) Prim’s algorithm can be viewed as applying the blue rule of the general greedy method n –1 times to create a minimum spanning tree. It then implicitly colors the remaining edges red without ever considering their edge weights. Explain why this last step is consistent with the general greedy method.

Suppose an application uses Prim’s algorithm for minimum spanning trees and we happen to know that for the graphs that arise in the application, changkey is called at most n 4/3^ times. Based on this, derive an estimate for the best choice of d for this application. How many levels will the heap have if n =10 6?

CS 542 – Advanced Data Structures and Algorithms

Exam 1

Jonathan Turner 2/18/

  1. (12 points) Consider a 2-heap on 16 thousand items with key values that are randomly distributed between 0 and 1 million. If we inserted an item with a key of 0 into the heap, approximately how many iterations would siftup perform? Explain.

What if the inserted item had a key of 500 thousand? Explain.

Suppose that instead of insert, we did a deletemin. Approximately how many iterations would the siftdown procedure perform? Explain.

Suppose that we selected an item at random and did a changekey on that item with a new key value of 60,000. Estimate the number of levels the item will move. Explain.

  1. (9 points) The diagram shown below is the residual graph for some flow. Identify a shortest augmenting path in this residual graph. How much flow can be added to this path?

Identify a maximum capacity augmenting path in the residual graph. How much flow can be added to this path?

Find the path that would be selected by the capacity scaling algorithm if the current scale factor was 3. How much flow can be added to this path?

s

a

c

b

d

e

t

7

4

3

2

3

2

2

(^4 2 )

4

3

2

3

1

2

2

  1. (10 points) Let G be a directed graph in which each edge ( u , v ) has a length length ( u , v ). Describe (in words) an algorithm to determine if G has k edge disjoint paths between a given pair of vertices x and y , where the total length of all the paths is no larger than some bound B. Explain how this computation can be done in O( mn + km log n /log (2+ m / n )) time.
  1. (15 points) Consider an execution of the shortest augmenting path algorithm. Suppose that from step number 100 to step number 200, all the augmenting paths have 50 edges. Let k= 160 and suppose that x is on the augmenting path chosen during step k +1. Give an upper bound on the value of level (^) k ( x ) (recall that level (^) k ( x ) is the number of edges in a shortest path from the source vertex to x in the residual graph immediately following step k ). Explain your answer.

Suppose that during step k+1 , an edge ( u , v ) is added to the residual graph. Give an equation relating the value of level (^) k ( u ) to level (^) k ( v ). Explain your answer

Give an equation relating the value of level 99 ( u ) to level 99 ( v ). Explain your answer.

Let S be the set of edges ( x , y ) for which level 99 ( y )= level 99 ( x )+1. Is it possible for S to have exactly 85 edges? Why or why not?