Midterm2PracticeProblemsHints_Apr2018.pdf

# I there is an edge from every person to the target t

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

i . There is an edge from every person to the target t of capacity k . What will be the weights of the edges? 6. Suppose computer A and computer B are part of the same network, and are in the same connected component. There are directed edges connecting computers in this network. Computer A has a virus, and computer B has important data, so we want to quickly separate A from B . To do this, we can remove edges from the network. We want to calculate the minimum number of edges that we have to remove in order to separate A from B (i.e., when we remove these edges, A and B should be in different components). For this problem, we just need to know the number of edges, not the actual edges themselves. Hint: Remember that the max-flow is equal to the min-cut! 7. Suppose you are trying to navigate a set of roads to get from point A to point B . Assume that the roads are on a grid. All roads are one-way roads, and point either straight north or straight east. Your job is to get from the southwest corner to the northeast corner of the grid. At each intersection, there are traffic lights, each of which has some delay associated with it. Let d i,j represent the delay caused by the intersection at position ( i, j ) of the grid. At each intersection, you can turn in the direction of the intersecting road, or continue on the current road. Design a dynamic programming algorithm to determine the path of roads you should take to get from the southwest corner to the northeast corner of the grid with the smallest total delay. Hint: Define T [ i, j ] to be the minimum total delay required to get to the 3

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

View Full Document
( i, j ) intersection from the starting position. What subproblems do you need in order to calculate this value? You need the time to get to the intersection immediately to the west and the time to get to the intersection immediately to the south. How can you use these subproblems to calculate T [ i, j ]? 8. Santa Claus is packing his sleigh with gifts. His sleigh can hold no more than c pounds. He has n different gifts, and he wants to choose a subset of them to pack in his sleigh. Gift i has utility u i (the amount of happiness gift i induces in some child) and weight w i . We define the weight and utility of a set of gifts as follows: The weight of a set of gifts is the sum of their weights. The utility of a set of gifts is the product of their utilities.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern