1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Lady bird [3.3K]
3 years ago
5

Suppose we wanted to make change for purchases and wanted to use the least number of coins possible. Here is a greedy algorithm:

for the change amount due, we always use the largest-face-value coin first. Assume we have only coins of quarters ($.25), twenties ($.20), and pennies ($.01). Assume the change is $.40: a. what would be the coins and their numbers obtained by the greedy algorithm above
Computers and Technology
1 answer:
love history [14]3 years ago
5 0

Answer:

Explanation:

The following code is a Python function that takes in the amount of change. Then it uses division and the modulo operator to calculate the number of coins that make up the changes, using the greatest coin values first.

import math

def amountOfCoins(change):

   print("Change: " + str(change))

   quarters = math.floor(change / 0.25)

   change = change % 0.25

   dimes = math.floor(change / 0.20)

   change = change % 0.20

   pennies = math.floor(change / 0.01)

   print("Quarters: " + str(quarters) + "\nDimes: " + str(dimes) + "\nPennies: " + str(pennies))

You might be interested in
Obtaining the data of a video file from a flash drive is an example of a(n) _________ operation.
galben [10]

Obtaining the data of a video file from a flash drive is an example of a(n) _________ operation.

a)retrieval. b)comparison. c)storage. d)exponentiation.  

Answer:

a)retrieval.

Explanation:

A retrieval operation simply means obtaining data or information that is stored in a system.

Therefore, getting the data of a video file from a flash drive is a retrieval operation because it brings the video file from the storage device.

3 0
3 years ago
Please answer quick:))))
Anika [276]
I think B and the second one C
8 0
3 years ago
A page-replacement algorithm should minimize the number of page faults. We can achieve this minimization by distributing heavily
tekilochka [14]

Answer:If you think that a blank sheet of paper or a blinking cursor on the computer screen is a scary sight, you are not alone. Many writers, students, and employees find that beginning to write can be intimidating. When faced with a blank page, however, experienced writers remind themselves that writing, like other everyday activities, is a process. Every process, from writing to cooking to bike riding to learning to use a new cell phone will get significantly easier with practice.

Just as you need a recipe, ingredients, and proper tools to cook a delicious meal, you also need a plan, resources, and adequate time to create a good written composition. In other words, writing is a process that requires steps and strategies to accomplish your goals.

These are the five steps in the writing process:

Prewriting

Outlining the structure of ideas

Writing a rough draft

Revising

Editing

Effective writing can be simply described as good ideas that are expressed well and arranged in the proper order. This chapter will give you the chance to work on all these important aspects of writing. Although many more prewriting strategies exist, this chapter covers six: using experience and observations, freewriting, asking questions, brainstorming, mapping, and searching the Internet. Using the strategies in this chapter can help you overcome the fear of the blank page and confidently begin the writing process

Explanation:

4 0
3 years ago
What happens if part of an ftp message is not delivered to the destination?
Oliga [24]

The message is lost when an FTP message is not delivered to its destination because FTP doesn't use a reliable delivery method.

<h3>What is FTP?</h3>

FTP is an abbreviation for file transfer protocol and it can be defined as a type of server that's designed and developed to store and provide files for download, as well as sharing between two or more users on an active computer network.

Generally, the message is lost when an FTP message is not delivered to its destination because FTP doesn't use a reliable delivery method.

Read more on FTP here: brainly.com/question/20602197

#SPJ12

4 0
2 years ago
1 what elements of composition are under your control in photoshop
inn [45]
Tone
Sharpness
Scale
Arrangement
7 0
3 years ago
Other questions:
  • Cleo finds herself frequently searching for messages from particular senders or with specific subjects. What should she create
    5·1 answer
  • Give the difference betewen recursion and interation in C. Sight what are the advantages and their disadvantages?
    7·1 answer
  • Whereas lines of competition are clearly defined in the more established industries, in the Internet industry they are blurred a
    9·1 answer
  • Write the following function without using the C++ string class or any functions in the standard library, including strlen(). Yo
    12·1 answer
  • A keyboard and touch screen are the most common of ________ devices. select one:
    11·1 answer
  • Which of the following code segments does not contain any errors?
    7·1 answer
  • How do you turn on the Track Changes feature in a word-processing document?
    12·1 answer
  • Which of the following is not a hazard a driver might encounter?
    5·1 answer
  • Which file system is designed to verify and autocorrect data faults on the volume without having to bring the volume down for ma
    11·1 answer
  • 8.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!