Analysis of Advanced Data Structures and Algorithms Exam 2, Exams of Data Structures and Algorithms

Questions and solutions related to the cs 542 – advanced data structures and algorithms exam 2. The questions cover topics such as partition data structure, nearest-common ancestor algorithm, round-robin algorithm, and edmonds algorithm. Students are expected to understand concepts like find operation, dominant node, nearest open ancestor, blossoms, and augmenting paths.

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. (15 points) Consider a find operation on the partition data structure in which the “find
path” has 21 nodes. What is the smallest number of nodes that the partition data structure
could contain. Explain your answer.
In the O(m log log n) analysis of the partition data structure, we defined the notion of a
dominant node. Suppose the partition data structure has 16 million nodes. If the root of the
tree involved in the above find operation has a rank of 30, what is the maximum number of
nodes along the find path that could be dominant? Explain your answer.
Consider a node x with rank(x)=0 and rank(p(x))=8. Suppose we perform three operations
involving node x and x is not dominant immediately before each of these find operations.
What is the smallest possible value that rank(p(x)) can have after these three find operations
have completed? Explain your answer.
CS 542 – Advanced Data Structures and Algorithms
Exam 2
Jonathan Turner 4/2/2012
pf3
pf4
pf5

Partial preview of the text

Download Analysis of Advanced Data Structures and Algorithms Exam 2 and more Exams Data Structures and Algorithms in PDF only on Docsity!

  1. (15 points) Consider a find operation on the partition data structure in which the “find path” has 21 nodes. What is the smallest number of nodes that the partition data structure could contain. Explain your answer. In the O ( m log log n ) analysis of the partition data structure, we defined the notion of a dominant node. Suppose the partition data structure has 16 million nodes. If the root of the tree involved in the above find operation has a rank of 30, what is the maximum number of nodes along the find path that could be dominant? Explain your answer. Consider a node x with rank ( x )=0 and rank ( p ( x ))=8. Suppose we perform three operations involving node x and x is not dominant immediately before each of these find operations. What is the smallest possible value that rank ( p ( x )) can have after these three find operations have completed? Explain your answer.

CS 542 – Advanced Data Structures and Algorithms

Exam 2

Jonathan Turner 4/2/

  1. ( 12 points) The diagram below shows a partial representation of an intermediate state in the execution of the nearest-common ancestor algorithm. In the depth-first-search, which nodes are open? What is the nearest open ancestor for each of the nodes s , n and f? For which pairs has the algorithm computed the nca values at this point? Show how the partition changes after the current recursive call to the nca function returns Partition e a f b d c h g j i r q k^ m p^ n s j i s d r q p^ n t h t a b c f k e m g pairs : { i , g ), { j , t }, { e , r }, { d , r }, { e , k } tree
  1. (15 points) The figure below shows an intermediate stage in the execution of Edmonds algorithm for finding a maximum size matching. The matching edges are not shown explicitly, but parent pointers are shown and the partition data structure is shown. Draw closed curves around the vertex sets which form blossoms in the current graph. Mark the bridges of the blossoms with a B. Mark even vertices with a plus sign and odd vertices with a minus sign. Indicate which edges are in the current matching, by marking them with an M. If edge { g , h } is processed next, an augmenting path is found. List the vertices in that augmenting path. k a s g d m n i q 0 0 0 0 0 (^0 ) 1 b c e h j^ p r 0 0 0 0 0 0 1 b s g h k d e a n (^) m j c i p r q
  1. ( 20 points) In the analysis of the shortest augmenting path algorithm, we defined leveli ( u ) to be the length of the shortest path from s to u in the residual graph, after the i - th augmenting step. As the algorithm progresses, leveli ( t ) increases at various points and we can define a phase to be the period between two successive changes to leveli ( t ). What is the largest number of phases that the shortest augmenting path algorithm will execute on a unit network with n vertices and m edges? Explain your answer. Suppose that for a given phase leveli ( t ) = k. Give an upper bound on the number of augmenting path steps in that phase. (Hint: in a unit network, can two augmenting paths found in the same phase pass through the same vertex?) Explain your answer. Now, give an upper bound on the time spent finding augmenting paths of length k. Now, use the results from the last two steps to derive an upper bound on the total time spent by the shortest augmenting path algorithm on a unit network.
  1. (20 points) In the analysis of the self-adjusting binary search trees, a certain number of credits are allocated to each splay. Suppose that 25 credits are allocated to a splay at node x. What is the smallest possible number of nodes in the tree? Explain your answer. What is the change to the value of rank ( x ) as a result of this splay? Explain your answer. Suppose that a splay at a node x has ten splay steps, all of which involve a double-rotation. Suppose that for six of these splay steps, p ( p ( x )) has the same rank as x and for the remaining steps the rank of p ( p ( x )) is equal to rank ( x )+3. If C 1 is the number of credits needed to maintain the credit invariant before the splay, and C 2 is the number needed after the splay, give a lower bound on the difference C 1 C 2. Explain your answer.