Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 3 . Tatte Like Latte Part One ( 1 0 points ) Problem 4 . Tatte Like Latte Part Two ( 1 0 points
Problem Tatte Like Latte Part One points Problem Tatte Like Latte Part Two points
You've eaten your fill of pastries, and now you have a new dollar amount to spend on Tatte's
ground coffee beans. Like before, you've assigned a rating to each type of bean. Each type also has
a priceperpound listed, but you don't need to buy an entire pound of beans; instead, you can buy
up to one pound of any type. You can also buy multiple types, as long as you don't go over your
$ limit
For example, here is what the menu might look like now.
a Going by ratings largest to smallest what would a Greedy solution be assuming you have
$ to spend and can purchase up to one pound of any coffee flavor? What would the total
rating be
Solution:
b In some versions of this problem, we compute the ratio of value ranking to weight price
as shown in the table below. Using the ratingperdollar as the way each item is evaluated,
what would a Greedy solution be assuming you have $ to spend? What would the total
rating be
Solution:
c Give the pseudocode for a greedy solution that would go by either Rating, or Ratingper
Dollar, whichever is better based on your solutions above. You can assume you have access
to any sorting algorithm we've covered. Your algorithm should take as parameters: the
total dollar amount you can spend, an array of coffee prices, and a corresponding array of
coffee ratings. It should return the total rating of an optimal solution.
Solution: Problem Greedy Optimal? points
In one of the two Tatte problems, you found that the greedy strategy did well; your greedy choice
was either the rating of an item, or ratingperdollar. Now your job is to show that the greedy
choice you made does yield an optimal solution.
a In which problem above did you find that Greedy gave you a pretty good solution? Was your
greedy choice rating, or ratingperdollar?
Solution:
b Show that your greedy choice would always yield an optimal solution for that problem. Start
with defining to be a subproblem of the Tatte problem, and let be an optimal solution to
Solution:
You have $ to spend on pastries at Tatte. In the bakery display, you see exactly one of each item
each has a price listed next to it and you've personally assigned a rating of as well. You want
to spend your money in an optimal way, ie you want to maximize the sum of ratings on your
items without going over $
Here are the items you can buy, along with their prices and your individual ratings:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started