Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7572317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:53:45+00:00 2026-05-30T15:53:45+00:00

My assignment is to write an algorithm using brute force to determine the number

  • 0

My assignment is to write an algorithm using brute force to determine the number of distinct ways, an related combinations of change for given amount. The change will be produced using the following coins: penny (1 cent), nickel (5 cents), dime (10 cents), and quarter (25 cents).

e.g.

Input: 16 (it means a change of 16 cents)

Output: can be produced in 6 different ways and they are:

  1. 16 pennies.
  2. 11 pennies, 1 nickel
  3. 6 pennies, 1 dime
  4. 6 pennies, 2 nickels
  5. 1 penny, 3 nickels
  6. 1 penny, 1 nickel, 1 dime

My algorithm must produce all possible change combinations for a specified amount of change.


I am at a complete loss as to how to even begin starting an algorithm like this. Any input or insight to get me going would be awesome.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T15:53:47+00:00Added an answer on May 30, 2026 at 3:53 pm

    Ok. Let me explain one idea for a brute force algorithm. I will use recursion here.

    Let’s you need a change of c cents. Then consider c as

    c = p * PENNY + n * NICKEL + d * DIME + q * QUARTER
    

    or simply,

    c = ( p * 1 ) + ( n * 5 ) + ( d * 10 ) + ( q * 25 )
    

    Now you need to go through all the possible values for p, n, d and q that equals the value of c. Using recursion, for each p in [0, maximumPennies] go through each n in [0, maximumNickels]. For each n go through each d in [0, maximumDimes]. For each d go through each q in [0, maximumQuarters].

    p in [0, maximumPennies] AND c >= p
      |
      +- n in [0, maximumNickels] AND c >= p + 5n
           |
           +- d in [0, maximumDimes] AND c >= p + 5n + 10d
                |
                +- q in [0, maximumQuarters] AND c >= p + 5n + 10d + 25q
    

    For any equality in these steps you got a solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been asked to write a program using python for an assignment. I
Recently for a programming class, we were given the assignment to write a program
A while back we were given an assignment to write a c program that
I have an assignment to write an algorithm to find duplicate in a Dynamic
I was given an assignment to write a program to print only even numbers
I'm using python 3 for a small extra credit assignment to write an RSA
My kiddo had a homework assignment to write Blackjack in Java. I helped him
In my assembly language class, our first assignment was to write a program to
Please write a list of tasks that a copy constructor and assignment operator need
For a school assignment I have to write x86 assembly code, except I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.