# Sol4b - CS 577: Introduction to Algorithms 11/16/06...

This preview shows pages 1–3. Sign up to view the full content.

CS 577: Introduction to Algorithms 11/16/06 Homework Solution: 4b Instructor: Shuchi Chawla TA: Siddharth Barman Question 1 1 1 1 1 -k 1 2 n Layer 2 i 0 0 0 j -(n-k) 1 1 1 1 1 1 1 1 1 1 Layer 1 Figure 1: Circulation Demands Given a pair of boxes it takes a constant amount of time to determine whether one ±ts into the other, essentially we look at all the six possible permutations (we can use bipartite matching to determine this as well). Hence in O ( n 2 ) time we can determine all the containment relations, i.e. for each box pair i and j we know if j ±ts into i or not. First we solve a related “veri±cation version” of the problem and use this as a black box to solve the initial problem of determining the minimum number of visible boxes. The veri±cation version A is simply stated as: given the set of n boxes and a number k does there exist a nesting arrangement in which only k boxes are visible. This algorithm A returns a yes if such a nesting arrangement exists else it returns a no. The original problem is to determine the minimum number l for which the veri±cation algorithm returns a yes. We can use A and do a binary search for l . Hence if the time complexity of A is O ( T ) we need O ( T log n ) time to solve the initial problem. The veri±cation algorithm can be cast as a ²ow graph with circulation demand, see Figure 1. Layer 1 has representative nodes, in particular node i in layer 1 stands for box i and there is a 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
directed edge of capacity one from i to j if box j Fts into box i . Layer 2 contains a node for each box, with a demand of 1. The unit demand essentially implies that the box wants to be contained in some other “box”. The crux is that there is a nested arrangement with exactly k visible boxes i± the circulation demands of each vertex is met. As stated above the demand represents the containment intention of a box. The node on the right with a - k demand stands for the room and k nodes of Layer 2 are satisFed by this the rest of the n k nodes are satisFed by ²ow coming from the left i.e. they are
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 02/17/2011 for the course CS 577 taught by Professor Joseph during the Spring '08 term at Wisconsin.

### Page1 / 5

Sol4b - CS 577: Introduction to Algorithms 11/16/06...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online