Question

The post office sells stamps of a variety of different denominations (values), and different sizes. Consider...

The post office sells stamps of a variety of different denominations (values), and different sizes. Consider a set of n stamps, where each stamp i has a specific denomination di and a size si . All denominations are distinct. All input numbers are positive integers. We can use stamp denominations multiple times. When buying stamps that total to a given postage amount P, we want to minimize the total size of the stamps (to leave the most addressing space on the envelope).

(a) Design and write, in pseudocode, a dynamic programming algorithm that will, given the information about n stamps (denominations {di} and sizes {si}) and a postage amount P, find the minimum total size of stamps that will add to exactly P (if such a set exists).

(b) Adapt your algorithm from (a) to find the set of stamps that produces the minimum.

(c) Analyze the running time (in terms of input size) of your algorithm from (a).

0 0
Add a comment Improve this question Transcribed image text
Answer #1

he appscach can be as The m ams oil be sorted bate od slompt c that adding their deneminathicn amuse amy gcedte.chnique requi

Add a comment
Know the answer?
Add Answer to:
The post office sells stamps of a variety of different denominations (values), and different sizes. Consider...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Making Change: Given coins of denominations (value) 1 = v1 < v2< … < vn, we...

    Making Change: Given coins of denominations (value) 1 = v1 < v2< … < vn, we wish to make change for an amount A using as few coins as possible. Assume that vi’s and A are integers. Since v1= 1 there will always be a solution. Formally, an algorithm for this problem should take as input:  An array V where V[i] is the value of the coin of the ith denomination.  A value A which is the amount...

  • Recall the coin changing problem: given coins of denomination di zonks, where 1 = d1 <...

    Recall the coin changing problem: given coins of denomination di zonks, where 1 = d1 < d2 < ··· < dk, and infinitely many coins of each denomination, find the minimum number of coins needed to make exact change for n zonks. Here we ask a different problem. Each coin has a weight, the weight of each coin with denomination di being wi > 0. We want to make exact change while minimizing the total weight of the coins used....

  • program in python Randomness can be used to improve the performance of deterministic algorithms which need...

    program in python Randomness can be used to improve the performance of deterministic algorithms which need to make many choices. Rather than repeatedly making fixed, hard-coded choices, a pseudorandom number generator can be used to make dynamic, unbiased choices. If the benefits of "good" choices outweigh the costs of "bad" choices, a random selection of good and bad choices can improve the performance of an algorithm Let us explore this with the QUICKSELECT algorithm. Discovered by the influential computer science...

  • Q1 Error detection/correction Can these schemes correct bit errors: Internet checksums, two-dimendional parity, cyclic...

    Q1 Error detection/correction Can these schemes correct bit errors: Internet checksums, two-dimendional parity, cyclic redundancy check (CRC) A. Yes, No, No B. No, Yes, Yes c. No, Yes, No D. No, No, Yes E. Ho, hum, ha Q2 CRC vs Internet checksums Which of these is not true? A. CRC's are commonly used at the link layer B. CRC's can detect any bit error of up to r bits with an r-bit EDC. c. CRC's are more resilient to bursty...

  • You need not run Python programs on a computer in solving the following problems. Place your...

    You need not run Python programs on a computer in solving the following problems. Place your answers into separate "text" files using the names indicated on each problem. Please create your text files using the same text editor that you use for your .py files. Answer submitted in another file format such as .doc, .pages, .rtf, or.pdf will lose least one point per problem! [1] 3 points Use file math.txt What is the precise output from the following code? bar...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT