Question: Please help me to solve the problem with java language! Write functions called coinChangeDP and coinChangeGreedy that take an array of coin denominations and an

Please help me to solve the problem with java language!

Write functions called "coinChangeDP" and "coinChangeGreedy" that take an array of coin denominations and an amount of change. The functions will attempt to return the minimal number of coins necessary to make the specified amount of change using the specified denominations. (The DP result will be minimal, while the greedy one will not.) for example, the signature of the methods would look like this shown below =>

 public static int coinChangeDP(int[] coinValues, int change) public static int coinChangeGreedy(int[] coinValues, int change)

The code used to test your function will look similar to this:

 int[] coins = {50,25,10,5,1}; for(int i=1; i<=55; i++) { System.out.print(i + "\t"); System.out.print(coinChangeDP(coins, i) + "\t"); System.out.println(coinChangeGreedy(coins, i)); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!