Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2 Caveat Venditor Due to dwindling popularity, the world's last DVD store is closing down and having a sale to get rid of their remaining
Caveat Venditor
Due to dwindling popularity, the world's last DVD store is closing down and having a sale to get
rid of their remaining inventory of movies. Every movie costs the same amount crowns, and in
addition they have distributed a large number of coupons all over town with offers along the lines
of "Buy any five movies, get two of them for free". This means that you can get any movies in
the store even copies of the same movie for a cost of crowns instead of crowns
An avid DVD collector wants to buy of the movies available in the store, and to get the best
deal they have gone around town and collected a large number of the discount coupons for
some reason, nobody else was interested in them The coupons can have different offerings. Eg
one could be "buy three, get one for free", another could be "buy get for free", etc. Now
the collector has a conundrum: what is the best way to use these coupons in order to get all
movies as cheaply as possible? It is fine to buy a few additional movies if that leads to a smaller
total cost see example below Each coupon can only be used once.
Design an algorithm which given the set of available coupons, finds the smallest total cost of
buying the movies. The algorithm must have time complexity polynomial in and assuming
a unit cost analysis eg you may assume that addingmultiplyingcomparing two numbers
takes time The input to the algorithm consists of:
The integers and as described above.
For each a pair of integers where indicating that the
th coupon says "buy get for free".
Can you use the dynamic Programming to solve it
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