Initially the 10 gallon container holds no water and

Info icon This preview shows pages 3–4. Sign up to view the full content.

Initially, the 10 gallon container holds no water, and the 7 gallon and 4 gallon containers are both full. Is there a sequence of moves that leaves exactly 2 gallons in either the 7 gallon or 4 gallon container? Model this as a graph problem. Which algorithm should you apply to deter- mine whether such a sequence exists? Solution Hint: Let each vertex in the graph represent a distribution of water among the 3 containers (e.g., (10, 0, 1) indicates that the first container has 10 gallons and the last container has 1 gallon, and (0, 7, 4) indicates the starting condition). Let edges represent legal moves. 10. a. Prove that in any connected, undirected graph, it is possible to remove some vertex and still leave the graph connected. b. Give an example of a strongly connected directed graph such that removal of any vertex results in a graph that is not strongly connected. Solution Hint: Remove a leaf of the DFS tree. Is the rest of the graph still connected? 11. You are given a strongly connected directed graph G , and a specified 3
Image of page 3

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

node u . Create an efficient algorithm that finds the shortest- u -paths be- tween all pairs of nodes in G , where the shortest- u -path from s to t is the shortest path from s to t that passes through u . Solution Hint: How can you describe a shortest- u -path from s to t ? Think of the in-class exercise where we created an algorithm to decide which road to add to a graph. 4
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern