Homework

Homework Questions? Ask a Tutor for Answers ASAP

Connect one-on-one with {0} who will answer your question

Customer Question

5, and 1 cent. An...

In the US, coins are minted with denominations of 50, 25, 10, 5, and 1 cent. An algorithm for making change using the smallest possible number of coins repeatedly returns the biggest coin smaller than the amount to be changed until it is zero. For example, 17 cents will result in the series 10 cents, 5 cents, 1 cent, and 1 cent.

a) Write a recursive algorithm for changing n cents.

b) Analyze its time complexity.

c) Write an O(1) (non-recursive!) algorithm to compute the number of returned coins.

d) (1 point) Show that the above greedy algorithm does not always give the minimum number of coins in a country whose denominations are 1, 6, and 10 cents.

e) (2 points) What is the average number of coins that your algorithm from part (a) returns if you have to change 1,2,…,100 cents, and every amount appears with the same probability?

a) Write a recursive algorithm for changing n cents.

b) Analyze its time complexity.

c) Write an O(1) (non-recursive!) algorithm to compute the number of returned coins.

d) (1 point) Show that the above greedy algorithm does not always give the minimum number of coins in a country whose denominations are 1, 6, and 10 cents.

e) (2 points) What is the average number of coins that your algorithm from part (a) returns if you have to change 1,2,…,100 cents, and every amount appears with the same probability?

Show More

Show Less

Was this answer helpful?

Describe your issueThe assistant will guide you

Chat 1:1 with a tutorLicensed Experts are available 24/7

100% satisfaction guaranteeGet all the answers you need

Related Homework Questions

WRITE DOWN THE NETBEANS JAVA FOR FLIP COIN. Problem #1:

Problem #1: Consider you have a fair coin, thus both sides have equal chance of appearing after tossing the coin; 50% for heads, and 50% for tails. Each time you flip a head, you lose a point, and each time you flip a tail, you gain a point. How many trials on average will it take you to have a sum of zero? What will be the likely-hood of each number of trials? Write down a Java code that simulates such process to calculate the average number of trials needed and plot the likely-hood of the trials. … read more

I have a project where i have to code in java. I am a first

i am a first year computer science student in programming one. do you need the problem? … read more

1.1 Write a program to help a bank teller keep track of

1.1 Write a program to help a bank teller keep track of coins in their till. A bank teller needs a program to help keep track of how many pennies, nickels, dimes, and quarters they have. Every time th… read more

1.Write a simple program that creates an array of size 10

1.Write a simple program that creates an array of size 10 that holds whole numbers. Fill it with random numbers using the Random class and print out the contents of the array.2. Write a method that gi… read more

First year computer science student the question is: Write a

first year computer science student the question is: Write a method that given an array size and a whole number, creates an array of that size, fills it with that whole number and returns a reference … read more

I'm having trouble with a java assignment. I am supposed to

I am supposed to be getting user input for amount of change and outputting the number of coins they are receiving … read more

I need python help. I dont have solution yet im stuck on

i dont have solution yet im stuck on several questions … read more

Australian coin denominations are: 5c, 10c, 20c, 50c, $1 and

Australian coin denominations are: 5c, 10c, 20c, 50c, $1 and $2.Write a program that generates all possible ways of generating the sum $1.40 with these coins. You should output one solution per line. … read more

A set of test data in tabular form with expected results and

A set of test data in tabular form with expected results and desk check results from algorithm below. Each test data must be justified – reason for selecting that data. Add rows to the following table… read more

Choose 2 non-recursive sorting algorithms that you have read

Choose 2 non-recursive sorting algorithms that you have read about in the text or in the supplemental resources. Discuss (compare and contrast) the time complexities and space complexities of each alg… read more

Need help with this question below using python Part 1

need help with this question below using python Part 1 •Design a greedy algorithm using pseudocode that solves this optimization problem of transferring files to disk while minimizing unused storage. … read more

Analyze the time complexity of the recursive Fibonacci

Analyze the time complexity of the recursive Fibonacci algorithm in terms of how many lines of code will be executed. Look very carefully at your recursive code. If you use an n of 5, how many lines o… read more

Well I have a programs to write and I have a PDF for

Well I have a programs to write and I have a PDF for instructions. Can you assist? Here is the details: Between these two programs, where it makes sense, you must demonstrate at least one example each… read more

1. Write a recursive algorithm to compute a+b, where a and

1. Write a recursive algorithm to compute a+b, where a and b are nonnegative integers. 2. Let a be an array of integers. Write a recursive algorithm to compute the average of the elements of the array… read more

Your job is to change the program so that it no longer uses

Your job is to change the program so that it no longer uses indexes anywhere within the executable code but instead uses pointers into the array. Hint: This will be easy to think about if you change a… read more

Your job is to change the program so that it no longer uses

Your job is to change the program so that it no longer uses indexes anywhere within the executable code but instead uses pointers into the array. Hint: This will be easy to think about if you change a… read more

Create a program that simulates a vending machine. Start with

Create a program that simulates a vending machine. Start with a fixed price for the one item the machine can sell: for example $4.05. Then create a loop that would repeatedly ask for coins to be inser… read more

Suppose you have been asked to design and implement a program

Suppose you have been asked to design and implement a program to control a vending machine that accepts up to $10 and provides correct change once a product is purchased. To test your design you have … read more

Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.

JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.

Web sites like justanswer.com/legal

...leave nothing to chance.

...leave nothing to chance.

Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.

Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.

I will tell you that...the things you have to go through to be an Expert are quite rigorous.

Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help.

Freshfield, Liverpool, UK

This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!!

Los Angeles, CA

Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult.

Hesperia, CA

I couldn't be more satisfied! This is the site I will always come to when I need a second opinion.

Kernersville, NC

Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around.

Woodstock, NY

Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know.

Elkton, Maryland

He answered my question promptly and gave me accurate, detailed information. If all of your experts are half as good, you have a great thing going here.

Dallas, TX

< Previous | Next >

Scott

MIT Graduate

5,558 satisfied customers

MIT Graduate (Math, Programming, Science, and Music)

LogicPro

Engineer

18,409 satisfied customers

Expert in Python,Java C++ C C# VB Javascript Design SQL HTML

Manal Elkhoshkhany

Tutor

4,775 satisfied customers

More than 5000 online tutoring sessions.

Linda_us

Finance, Accounts & Homework Tutor

3,138 satisfied customers

Post Graduate Diploma in Management (MBA)

Chris M.

M.S.W. Social Work

2,852 satisfied customers

Master's Degree, strong math and writing skills, experience in one-on-one tutoring (college English)

F. Naz

Chartered Accountant

2,273 satisfied customers

Experience with chartered accountancy

Bizhelp

CPA

1,887 satisfied customers

Bachelors Degree and CPA with Accounting work experience

< Previous | Next >

Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.