Design a dynamic programming algorithm

Assignment Help Computer Engineering
Reference no: EM132139771

Question :

Suppose you are buying stamps to put on a package at the post office.

The postage required to send the package is N dollars. You can buy $1, $7, and $10 stamps. You want to find the minimum number of stamps required so that you have at least SIV worth of stamps. Note that the solution to this problem may not actually be the cheapest solution in terms of dollars: for example, if you need stamps totaling $16, then you can buy a $10 and a $7 stamp, which adds up to $17.

Or you could buy a $10 stamp and six $1 stamps, which adds up to $16. The second solution requires seven stamps, so the first solution is better (even though it is more expensive). However, if there are multiple solutions that use the same number of stamps, then you should return the one that is cheapest.

Design a dynamic programming algorithm that finds the minimum number of stamps required. The input to your algorithm is the total desired postage value N. The output should be the number of stamps required. (You do not have to tell me which stamps were used.)

Part a: Draw the DAG corresponding to this problem. Hint: Let the nodes correspond to different total postage values, and let the edges correspond to different stamp choices.

Part b: Solve the dynamic programming problem using your DAG. Hint: Once you have drawn the DAG correctly, the original problem becomes a very simple graph problem on the DAG.

Reference no: EM132139771

Questions Cloud

Find a key by exhaustive search if the keyspace is of size : What is the expected time (in years) to find a key by exhaustive search if the keyspace is of size 288?
Confidence interval for the mean claim payment : How would I calculate this: Anystate Auto Insurance Company took a random sample of 382 insurance claims paid out during a 1-year period.
Analyze financial statements of a publicly traded company : Assignment - Write a financial analysis for a U.S.-based, publicly traded organization. Analyze the financial statements of a publicly traded company
Find a point estimate for p : Let p represent the proportion of Santa Fe black-on-white potsherds at the excavation site. Find a point estimate for p. (Round your answer to four decimal plac
Design a dynamic programming algorithm : Design a dynamic programming algorithm that finds the minimum number of stamps required. The input to your algorithm is the total desired postage value N.
Would you choose the default system parameters : Would you choose the default system parameters when installing the system software? Explain and support your answer with reasoning.
What is the running time of your algorithm : Design a recursive algorithm that constructs T from S1 and S2. Note that it is enough for your algorithm to describe the children of each node.
How many blocks pf main memory are there : What is the format of a memory address as seen by the cache, that is what are the sizes of the tag, block and offset fields.
Paper - state of the economy effects on assets management : Write a paper of 8-10 pages, double-spaced that discusses the following in detail: The state of the economy's effects on assets' management

Reviews

Write a Review

Computer Engineering Questions & Answers

  Could it use the same stack as the application program

When an operating system receives a system call from a program, a switch to the operating system code occurs with the help of the hardware.

  Compute the total capacity of the ram chips in bits

Summarise the address space by drawing a memory map of the computer system. Indicate the starting and ending addresses in hexadecimal for each ROM and RAM chips and any unused space. Show how the memory addresses are obtained - Compute the total c..

  Write an ada expression that evaluates to true

Write an Ada expression that evaluates to True if Name is between "Alice" and "Nick" inclusive.

  Draw the searching tree

Draw the searching tree and solve using any applicable searching strategy. The squares colored as grey cannot be used.

  Determine a formula relating the range r from the satellite

Determine a formula relating the range r from the satellite to an earth station to the satellite elevation 0 relative to the earth station.

  Write program that reads word and prints number of syllables

Write a program that reads a word and prints the number of syllables in the word.

  Discuss vulnerabilities an organization faces insider threat

the vulnerabilities an organization faces when insider threats are present, and mitigating measures an organization can take to identify and stop

  What is the maximum prison sentence for a corporate officer

What is the maximum prison sentence for a corporate officer who willfully makes a fraudulent certification on a required SEC report?

  Show a rightmost derivation for aacab

Show a rightmost derivation for aacab. For the following grammar and the right sentential form T * (E + T * F) determine the handle.

  Do you believe in the existence of wonder heaps

Give a one-sentence definition of i) worst-case running time, ii) tractable problems, iii) the Subset Sum Problem.

  Describe how you would do this with a secret sharing scheme

A military base consists of one general, two colonels, and five clerks. Describe how you would do this with a secret sharing scheme.

  Find out the model number of the item

Find out the maker(s) of the PC(s) with the fastest processor among all those PCs that have the smallest amount of RAM.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd