Question: Frank the frog dabbles in prognostications. He has projected the number of flies that will be
Fantastic news! We've Found the answer you've been seeking!
Question:
Question:
Transcribed Image Text:
Frank the frog dabbles in prognostications. He has projected the number of flies that will be around his lilypad loft on each of the following n days. Thus, d days from now, there will be fa flies around his lilypad. Frank also is quite sleepy, and likes to rest for days at a time. The more he rests, the hungrier he gets. If Frank has rested for r days, he has the appetite for a, flies. Once he wakes on a day he eats and then his appetite resets and returns to 0. Recall, the more Frank rests, the hungrier he gets, so a; j: Return HUNGRYFROG(fi fn-j). (@j) Intuitively, the algorithm figures out how many days of rest j are needed to eat all of the flies on the last day. It wakes Frank up on the last day, and then accounts for the j days of rest needed to work up his appetite to eat as much as possible on the last day, and recursively considers the best solution for first n -j days. Explain why your instance causes the greedy algorithm to return the wrong answer. Solution: (b) Let OPT(j) be the maximum number of flies Frank can eat over the first days. Give a recurrence to compute OPT(j) from OPT(1)..... OPT(j-1). Give a few sentences justifying why your recurrence is correct. Solution: (c) Using your recurrence, design a dynamic programming algorithm to output the optimal set of days for Frank to wake up. You may use either a top-down or bottom-up approach. Frank the frog dabbles in prognostications. He has projected the number of flies that will be around his lilypad loft on each of the following n days. Thus, d days from now, there will be fa flies around his lilypad. Frank also is quite sleepy, and likes to rest for days at a time. The more he rests, the hungrier he gets. If Frank has rested for r days, he has the appetite for a, flies. Once he wakes on a day he eats and then his appetite resets and returns to 0. Recall, the more Frank rests, the hungrier he gets, so a; j: Return HUNGRYFROG(fi fn-j). (@j) Intuitively, the algorithm figures out how many days of rest j are needed to eat all of the flies on the last day. It wakes Frank up on the last day, and then accounts for the j days of rest needed to work up his appetite to eat as much as possible on the last day, and recursively considers the best solution for first n -j days. Explain why your instance causes the greedy algorithm to return the wrong answer. Solution: (b) Let OPT(j) be the maximum number of flies Frank can eat over the first days. Give a recurrence to compute OPT(j) from OPT(1)..... OPT(j-1). Give a few sentences justifying why your recurrence is correct. Solution: (c) Using your recurrence, design a dynamic programming algorithm to output the optimal set of days for Frank to wake up. You may use either a top-down or bottom-up approach.
Expert Answer:
Answer rating: 100% (QA)
The detailed answer for the above question is provided below Answer The greedy algorithm for the Frank the Frog problem works as follows Compute the smallest j such that aj fn Wake Frank up on day n I... View the full answer
Related Book For
Smith and Roberson Business Law
ISBN: 978-0538473637
15th Edition
Authors: Richard A. Mann, Barry S. Roberts
Posted Date:
Students also viewed these algorithms questions
-
First, identify the symptoms of the individual and determine if they meet the criteria for a psychological disorder. If they do meet the criteria, determine which disorder(s) they have. David: I cant...
-
The Crazy Eddie fraud may appear smaller and gentler than the massive billion-dollar frauds exposed in recent times, such as Bernie Madoffs Ponzi scheme, frauds in the subprime mortgage market, the...
-
To the right is the graph of the position of the object versus time: Which of graphs below correctly shows the object's velocity versus time? velocity (m/s) velocity (m/s) 1.5 1 0.5 -0.5 -1 -1.5 15...
-
How do the contemporary theories of leadership relate to the earlier foundational theories?
-
How is a thread different from a process?
-
A 30-kg child slides down the amusement-park wave slide shown in Figure P9.29. When they are \(0.95 \mathrm{~m}\) above the water level their speed is \(2.2 \mathrm{~m} / \mathrm{s}\). At the top of...
-
Proprietary Fund Financial Statements. Von County has prepared the following statement of revenues, expenses, and changes in fund net assets for its proprietary funds. The county has three enterprise...
-
10. A plastic ball is rising in water with terminal speed v. If we use a different plastic whose density is double that of the original ball but still less that density of water, keeping the radius...
-
This is a new manufacturing corporation that issued $50000 common stock for cash on the first day. All overhead expenses are paid immediately by cash. To make it easy, there are no other operating...
-
On January 1, 20X1, Franklin Industries leased equipment on a four-year term at $150,000 annual rental payments to be paid in advance to Arden Ltd. There is a bargain purchase option on December 31,...
-
Gladstone Company tracks the number of units purchased and sold throughout each accounting period but applies its inventory costing method at the end of each period, as if it uses a periodic...
-
Based on the information on slide #29, compute the credit spread of an option-free corporate bond rated BB, with 3 years to maturity, F=$1,000, coupon rate of 8%, and annual coupon payments. Keep...
-
A gauge reading 6.06 psi is attached to a tank outlet with water discharging at 30 fps. What is the elevation of water in the tank above the level of the outlet
-
Problem 10 A Tim Duncan Topps Finest rookie card is number 101 in a set of 163. Six randomly selected and equally likely cards come in each pack. Of course, with random selection there is the chance...
-
Find the radius of a stars image on the retina of an eye if its pupil is open to 0 . 6 5 cm and the distance from the pupil to the retina is 2 . 8 cm . Assume = 5 5 0 nm
-
Chck Present and future value tables of $1 at 9% are presented below. PV of $1 FV of $1 PVA of $1 FVAD of $1 FVA of $1 0.91743 1.09000 0.91743 1.75911 1.0000 1.0900 0.84168 0.77218 1.18810 2.2781...
-
In 1995 Miguel purchased a home for $130,000. In 2000 he sold it for $170,000 and immediately purchased another one for $180,000, which he sold in 2007 for $235,000. How much taxable capital gain, if...
-
Johnson, who owned a hardware store, was indebted to Hutchinson, one of her suppliers. Johnson sold her business to Lockhart, one of Johnsons previous competitors, who combined the inventory from...
-
Iowa enacted a statute prohibiting the use of sixty-five-foot double-trailer-truck combinations. All of the other Midwestern and western States permit such trucks to be used on their roads. Despite...
-
Lenvil Miller owed $2,501.61 to the Star Bank of Cincinnati. Star Bank referred collection of Millers account to Payco-General American Credits, Inc. (Payco), a debt collection agency. Payco sent...
-
John Henry died on May 1, 2018. When does his final 1040 have to be filed?
-
In problem 49, when does the estate's taxable year end? problem 49, John Henry died on May 1, 2018. When does his final 1040 have to be filed?
-
John and Mary Hughes file their income tax return on a calendar year basis. John dies on May 15, 2018. Mary remarries on July 4, 2018. Can Mary file a joint return with John for the taxable year 2018?
Study smarter with the SolutionInn App