Can you please explain the logic behind this algo in detail...

On Fri, Jul 29, 2011 at 11:32 AM, ankit sambyal <ankitsamb...@gmail.com>wrote:

> Let S be the exact amount for which minimum coins are to found. And denom[]
> be the array which contains different denominations. Let N be the size of
> the denom[] array.
>
> Algo:
> 1. int memo[S]
> 2. initialize all its elements to infinite
> 3.for i=1 to S
>       for j=0 to N-1
>          if(denom[j] < i  &&  memo[i-denom[j]] +1 < memo[i])
>               memo[i]=memo[i-denom[j]] +1
> 4. return memo[S]
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
AMAN AGARWAL
"Success is not final, Failure is not fatal: It is the courage to continue
that counts!"

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to