subject

Consider the problem of making change for n cents using the fewest number of coins. assume that each coins value is an integer. a. you have available coin denominations of 1 cent, 5 cents, 10 cents, 25 cents, as in the us coins of penny, nickel, dime, quarter. assume there is infinite availability of each of these four coin denomination types. describe a greedy algorithm to make change using the fewest number of coins. b. consider your greedy algorithm and making change for n=30 cents. show that the optimal solution for making change includes your greedy choice. to do so, assume that your greedy choice is not in the optimal solution. then use the "cut and paste" argument to show that you can replace other coins by your greedy choice, therefore finding a better solution than what was assumed to be optimal. this is in contradiction to the assumption, so your greedy choice is in the optimal solution. c. although the greedy algorithm is optimal for the us coins, it is not necessarily optimal for any set of coins. give an example of a different set of made up coin denominations with different values, for which the greedy algorithm does not yield an optimal solution. your set should include a penny so that there is a solution for every value of n. as before, assume there is infinite availability of each of the coin denomination types. show specifically a counter example in which the greedy algorithm yields a change solution that is not optimal, that is, does not include the fewest number of coins. d. name another algorithmic approach that will find an optimal solution to your example in (c).

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:20
[a] create a class called “cycle” which has two instance integer variables as properties, “numberofwheels” and “weight.” create a constructor with two parameters, using the same variable names in the parameter list. assign each variable to numberofwheels” and “weight” respectively. write a separate application to test the class and display its properties. note: do not change the names of the instance variables or the variables listed in the constructor’s parameter list. [b] edit your class cycle by adding a default constructor which will assign the default values of 100 to represent the numberofwheels, and 1000 to represent the weight, by invoking a call to the other constructor. modify your application created in [a] to test the class.
Answers: 3
question
Computers and Technology, 23.06.2019 06:20
Which text function capitalizes the first letter in a string of text? question 10 options: upper capital first proper
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
Light travels at a speed of 186,000 miles a second. the distance light travels in a year is 5,865,690,000,000 miles/year 5,865,695,000,000 miles/year 58,656,950,000,000 miles/year 6,789,000,0000 miles/year
Answers: 1
question
Computers and Technology, 24.06.2019 10:20
Multiple choice project create a program with two multiple choice questions. 1. users have two attempts only, show attempt number each time. hint: while loop with break control. (20%) 2. only one correct answer for each question, use switch case for each question. (20%) 3. show total score after the two questions are answered. hint: . (20%) 4. user have options to answer the two questions again if first attempt score is not 100%. hint: if statment. (20%) 5. use string method .toupper() to allow users to enter with lowercase or uppercase letters. (20%) 1. where is the capital of the state of florida? a. orlando b. tallahassee c. miami d. tampa b 2. where is walt disney world park located in florida? a. orlando b. tallahassee c. miami d. tampa a
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, 25.06.2020 02:01
Questions on the website: 13722363