Sunday 15 June 2014

algorithm - Coin Change analysis -


{1,3,5} denomination coins; Yoga = 11. Find the minimum number of coins that can be used to make yoga (we can use any number of coins in each sect)

I change the coin The problem was not particularly capable of getting dynamic programming method but clarification anywhere.

How to calculate the complexity of the non-dynamic solution and then change it for dynamic? (Not Greedy)

Edit:

There is an implementation for which the analysis was done.

  public int findCoinChange (int [] coins, int sum, int count) {int ret = 0, maxRet = -1; If (zodiac == 0) maxRet = count; And if (zodiac & lt; 0) maxRet = -1; Else {for (int i: coins) {ret = findCoinChange (coins, zodiac - i, count + 1); If (Maxitt and Lt; 0) maxRet = ret; Otherwise if (rate> gt; & amp; amp; amp; & lt; maxRet) {maxRet = ret; }}} If (Maxtte & Lt; 0) returns -1; And most of the return; }   

It looks like a composite blast for me though I'm not sure how to get rid of a run time complexity for this.

This problem should be clearly O (k * n ) (nested loop, blah blah blah) where k is the number of coins and n is the amount that is being created for that change.

I do not know what you mean by non-dynamic programming solutions. Sorry, you can determine what your algorithm is. In some cases, you should not mention that thing to Do you mean linear programming solutions? This is a terrible approach to this problem because we do not know what the complexity is, and it is possible to move slowly.

I do not even know what you mean by "dynamic one to change it."

No comments:

Post a Comment