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 02:30
Larry sent an email to andy. andy didn't open larry's email but still understood what the message was. how did andy determine the message without opening the email?
Answers: 1
question
Computers and Technology, 23.06.2019 11:00
Describe three characteristics of at-risk drivers. a. b. c. describe three characteristics of safe drivers. a. b. c. describe three driver errors that could cause a collision. a. b. c. how will this information affect you as a driver now and in the future? (2-3 sentences)
Answers: 2
question
Computers and Technology, 23.06.2019 11:20
Http is the protocol that governs communications between web servers and web clients (i.e. browsers). part of the protocol includes a status code returned by the server to tell the browser the status of its most recent page request. some of the codes and their meanings are listed below: 200, ok (fulfilled)403, forbidden404, not found500, server errorgiven an int variable status, write a switch statement that prints out the appropriate label from the above list based on status.
Answers: 2
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
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, 07.10.2020 15:01
question
Chemistry, 07.10.2020 15:01
question
Mathematics, 07.10.2020 15:01
question
Mathematics, 07.10.2020 15:01
question
Mathematics, 07.10.2020 15:01
question
Mathematics, 07.10.2020 15:01
Questions on the website: 13722363