4. Treasure Island [25 points] In your favorite computer game they have added a new reward...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
4. Treasure Island [25 points] In your favorite computer game they have added a new reward phase between rounds where you can collect gold coins that you can spend in future game rounds. In this phase you are parachuted in a clown car to a location on an island where you can start your quest to get as much treasure as possible. You have a map of the island with the locations of treasure chests and the number of gold coins that each holds. You would really like to visit all of them and collect all of the treasure, but you can't because your only way to travel between them is on roads with those "severe tire damage" strips, making them one-way and preventing you from travelling on them in the wrong direction. Instead, you will have to make do with trying to get as many gold coins as possible. All of the treasure chests are at intersections of the roads. Your map shows all of these roads and which direction they run. Once you have reached a point where there is no way to collect any more gold coins, your treasure hunt ends. Your goal is to determine how to collect the maximum possible number of gold coins you could hope for. You realize that you can think of the map as giving a directed graph G with each intersection a vertex v of G marked by an integer ≥ 0 describing the number of coins in the treasure chest at that intersection, each one-way road as a directed edge, and the location you are parachuted to as a vertex u in this graph. For this question, as usual you should analyze the running time for your algorithms, which should be efficient, but you do not have to give a full proof that your algorithms are correct for any part. Instead, you should explain why you think each works in 2-3 sentences per part. (a) Suppose that G is strongly connected. • Describe an algorithm to find the maximum number of coins you would be able to collect. • Describe how to find a route that lets you collect that number of coins. (b) Suppose that G is a DAG. Describe an algorithm to find the maximum number of gold coins you can collect. To make this more concrete, consider the example below, where the best route is: a, b, c, d, e, f, though your algorithm should work for any DAG. (Hint: you may find this part conceptually easier if you do a topological sort first!) (a, 2) (b, 1 (d, 4) (9,5) h, 5) 4) (c) Now, stitch together the last two parts and describe an algorithm to handle any directed graph. 4. Treasure Island [25 points] In your favorite computer game they have added a new reward phase between rounds where you can collect gold coins that you can spend in future game rounds. In this phase you are parachuted in a clown car to a location on an island where you can start your quest to get as much treasure as possible. You have a map of the island with the locations of treasure chests and the number of gold coins that each holds. You would really like to visit all of them and collect all of the treasure, but you can't because your only way to travel between them is on roads with those "severe tire damage" strips, making them one-way and preventing you from travelling on them in the wrong direction. Instead, you will have to make do with trying to get as many gold coins as possible. All of the treasure chests are at intersections of the roads. Your map shows all of these roads and which direction they run. Once you have reached a point where there is no way to collect any more gold coins, your treasure hunt ends. Your goal is to determine how to collect the maximum possible number of gold coins you could hope for. You realize that you can think of the map as giving a directed graph G with each intersection a vertex v of G marked by an integer ≥ 0 describing the number of coins in the treasure chest at that intersection, each one-way road as a directed edge, and the location you are parachuted to as a vertex u in this graph. For this question, as usual you should analyze the running time for your algorithms, which should be efficient, but you do not have to give a full proof that your algorithms are correct for any part. Instead, you should explain why you think each works in 2-3 sentences per part. (a) Suppose that G is strongly connected. • Describe an algorithm to find the maximum number of coins you would be able to collect. • Describe how to find a route that lets you collect that number of coins. (b) Suppose that G is a DAG. Describe an algorithm to find the maximum number of gold coins you can collect. To make this more concrete, consider the example below, where the best route is: a, b, c, d, e, f, though your algorithm should work for any DAG. (Hint: you may find this part conceptually easier if you do a topological sort first!) (a, 2) (b, 1 (d, 4) (9,5) h, 5) 4) (c) Now, stitch together the last two parts and describe an algorithm to handle any directed graph.
Expert Answer:
Answer rating: 100% (QA)
describes a problem in which you need to find the maximum number of gold coins you can collect on a treasure island The island is modeled as a directed graph where intersections are vertices and roads ... View the full answer
Related Book For
Business Law The Ethical Global and E-Commerce Environment
ISBN: 978-0071317658
15th edition
Authors: Jane Mallor, James Barnes, Thomas Bowers, Arlen Langvardt
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
In Exercises solve the first-order differential equation by any appropriate method. y' = 2x1 - y
-
Birated Products Exports, L.P., is a limited partnership, with $235,000 in declared but unpaid profits. Birated Products's creditors include Garner Credit Inc. for $5,000 and Sarah, one of Birated...
-
What erosional features are likely found in an area of alpine glaciation? (See Figure 22.37 a ). Horn Cirques Horn Lateral Tarn moraine Cirques Arte Arte Arte Hanging valleys U-shaped valley Medial...
-
Mrs. Palsgraf was waiting for a train on a platform of a railroad. When a different train came into the station, two men ran to get on that train before it left the station. While one of the men...
-
Sid Davidson was able to determine the activity times for the leadership training program. He would like to determine the total project completion time and the critical path. The activity times...
-
At the conclusion of a second-year practical session, two groups of students engage in a heated debate. Group A students are certain that their results (Table 1) are statistically comparable to those...
-
A particle has an initial velocity of 3 ft/s to the left at So = 0 ft. Determine its position when t = 3 s if the acceleration is 2 ft/s to the right. B) 6.0 ft - D) 9.0 ft A) 0.0 ft C) 18.0 ft
-
Gary receives an operating distribution of $50,000 cash and a truck (not inventory) with an inside basis of $15,000. Gary's outside basis is $40,000 immediately before the distribution. a. Does Gary...
-
Consider a make vs. buy decision for a product that is NOT part of the company's core competency. The TCO is significantly lower with outsourcing and in the future internal cost is expected to rise....
-
indicste four groups of agents who are suppliers in the loanable funds market and explain why.
-
Should economic growth (as measured by increasing GDP) be a policy goal? Explain why and why not.
-
How do labor markets differ from the standard supply and demand curve and why?
-
Option pricing methodology is often used in complex real project valuations which allow for business investment opportunities throughout the life-time of the project. Using a simple net present value...
-
What mass of H2 will be produced when 122 g of Zn are reacted? Zn(s) + 2HCl(aq) ( ZnCl2(aq) + H2(g)
-
One of your clients, a motion picture producer, has asked your firm to invest $2 million in her latest motion picture production, a movie based on the life of 1960s singing star Janis Joplin. In...
-
On March 1, Sharon Fitzgerald entered into an oral lease of a house owned by Parkin. The lease was on a month-to-month basis, and the rent was set at $290 per month. Parkin also agreed to make...
-
Rusty Jones, a used car dealer, applied to First Financial Federal Savings and Loan Association for a $50,000 line of credit to purchase an inventory of used cars. First Financial refused to make the...
-
A diffraction grating is a closely spaced array of apertures or obstacles forming a series of closely spaced slits. The simplest type in which an incoming wave front meets alternating opaque and...
-
Find the position of the first minimum for a single slit of width 0.04 \(\mathrm{mm}\) on a screen of \(2 \mathrm{~m}\) distance, when light from a He-Ne laser \(\lambda=\) 6328 is shone on the slit.
-
A GaAs p-n junction has a \(100 \mu \mathrm{m} \times 100 \mathrm{~m}\) cross section and a width of the depletion layer \(W=440 \mathrm{~nm}\). Consider the junction in thermal equilibrium without...
Study smarter with the SolutionInn App