subject

Consider the problem of making change for n cents using the fewest number of coins. Assume that each coin's value is an integer.

a. Suppose that the available coins are in the denominations that are powers of c, i. e., the denominations are c0 ; c1; …; ck for some integers c > 1 and k _ 1. Show that the greedy algorithm of picking the largest denomination first always yields an optimal solution. You are expected to reason about why this approach gives an optimal solution. (Hint: Show that for each denomination ci, the optimal solution must have less than c coins.)

b. Design an Ο(nk) time algorithm that makes a change for any set of k different coin denominations, assuming that one of the coins is 3 cents in value.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 21:30
After you clean an engine with hot water spray, it seems to stall; when it doesn't stall, it's idling noisily. technician a says to check for loose bolts on the flex plate near the torque converter. technician b says to wipe down the spark plug wires and the distributor cap. who is correct? a. technician a b. both technicians a and b c. technician b
Answers: 1
question
Computers and Technology, 23.06.2019 11:30
Auser is given read permission to a file stored on an ntfs-formatted volume. the file is then copied to a folder on the same ntfs-formatted volume where the user has been given full control permission for that folder. when the user logs on to the computer holding the file and accesses its new location via a drive letter, what is the user's effective permission to the file? a. read b. full control c. no access d. modify e. none of the above
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. sean is a computer programmer. he has programmed an application for toddlers that plays nursery rhymes. however, a logic error has occurred in the program. which problem is a likely consequence of the error? a. the program crashes every time the user wants to play the nursery rhymes. b. the program crosses its buffer boundaries and overwrites an adjacent program. c. the program plays a different nursery rhyme than the one the user intended to play. d. the program shows different structures in its programming language code. e. the program introduces new viruses every time the user plays a nursery rhyme.
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
To check whether your writing is clear , you can
Answers: 2
You know the right answer?
Consider the problem of making change for n cents using the fewest number of coins. Assume that each...
Questions
question
Mathematics, 11.03.2021 02:20
question
Business, 11.03.2021 02:20
question
Mathematics, 11.03.2021 02:20
question
Chemistry, 11.03.2021 02:20
question
Arts, 11.03.2021 02:20