[algogeeks] Re: What algorithm can be used to decide the denomination of notes in an ATM machine?

2009-09-23 Thread eSKay
@Shishir cool! this seems to work!! C[i] = (N-1)/D[i] ; //this is super cool On Sep 21, 10:29 am, Shishir Mittal 1987.shis...@gmail.com wrote: Let the denominations be D[] = {1000,500,100}, and amount be N. Let C[] , denotes the count of each denomination. for ( i=0 ; i 2 ; i++) {        

[algogeeks] Re: What algorithm can be used to decide the denomination of notes in an ATM machine?

2009-09-23 Thread eSKay
@Channa thanks for explaining for the benefit of everybody. On Sep 22, 4:50 pm, Channa Bankapur channabanka...@gmail.com wrote: @eSKay, @Ankur, et al., Please be aware that there are non-Indians too in the group. Hi All, Let me try and define the problem precisely (as far as I can). The

[algogeeks] Re: What algorithm can be used to decide the denomination of notes in an ATM machine?

2009-09-23 Thread eSKay
I disagee. Please don't force your personal opinions on everybody like this. Thanks. On Sep 20, 4:39 pm, ankur aggarwal ankur.mast@gmail.com wrote: i think there is no use of discussing this ques.. On Sun, Sep 20, 2009 at 2:25 PM, eSKay catchyouraak...@gmail.com wrote: yes it is

[algogeeks] Re: What algorithm can be used to decide the denomination of notes in an ATM machine?

2009-09-22 Thread Channa Bankapur
@eSKay, @Ankur, et al., Please be aware that there are non-Indians too in the group. Hi All, Let me try and define the problem precisely (as far as I can). The ATM machines, which we generally see in India have the following behavior when an user tries to withdraw money from their Bank account.

[algogeeks] Re: What algorithm can be used to decide the denomination of notes in an ATM machine?

2009-09-21 Thread Shishir Mittal
Let the denominations be D[] = {1000,500,100}, and amount be N. Let C[] , denotes the count of each denomination. for ( i=0 ; i 2 ; i++) { C[i] = (N-1)/D[i] ; N = N - D[i]*C[i] ; } C[2] = N/D[2] ; For N=4800, C[] = {4, 1, 8} For N= 2000, C[] = {1, 1, 5}, as required. Nice

[algogeeks] Re: What algorithm can be used to decide the denomination of notes in an ATM machine?

2009-09-21 Thread Ramaswamy R
I don't quite get the if possible clause. But here is what we can do. Have an array C[i] with counts correspondint to denominations in D[i] (ordered). From the lowest denomination assign 1 of each until the total doesn't exceed the required amount. Once that is done, from the highest denomination

[algogeeks] Re: What algorithm can be used to decide the denomination of notes in an ATM machine?

2009-09-20 Thread Dufus
Is it different from classic Coin Denomination problem? _dufus On Sep 19, 11:20 pm, eSKay catchyouraak...@gmail.com wrote: for example: if I draw 2000, what I get is 1000+500+100+100+100+100+100. What algorithm can be used to decide how to break up the entered amount?

[algogeeks] Re: What algorithm can be used to decide the denomination of notes in an ATM machine?

2009-09-20 Thread eSKay
yes it is different. Coin Denomination Problem [http://haroonsaeed.wordpress.com/2006/06/06/ coin-denomination-problem/] [http://www.seeingwithc.org/ topic1html.html] would give 2000=1000+1000. Thats not the case with an ATM machine. On Sep 20, 10:21 am, Dufus rahul.dev.si...@gmail.com wrote:

[algogeeks] Re: What algorithm can be used to decide the denomination of notes in an ATM machine?

2009-09-20 Thread ankur aggarwal
@dufus i dont think becoz if u have to take 1000rs then we have 500 note and 100 rs note though we have 1000rs note. IT is in INDIA.. i dont know about other countries On 9/20/09, Dufus rahul.dev.si...@gmail.com wrote: Is it different from classic Coin Denomination problem? _dufus On Sep

[algogeeks] Re: What algorithm can be used to decide the denomination of notes in an ATM machine?

2009-09-20 Thread ankur aggarwal
i think there is no use of discussing this ques.. On Sun, Sep 20, 2009 at 2:25 PM, eSKay catchyouraak...@gmail.com wrote: yes it is different. Coin Denomination Problem [http://haroonsaeed.wordpress.com/2006/06/06/

[algogeeks] Re: What algorithm can be used to decide the denomination of notes in an ATM machine?

2009-09-20 Thread Dufus
@Ankur I cannot agree more with you Perhaps a more precise question would have been better instead of just an observation _dufus On Sep 20, 4:39 pm, ankur aggarwal ankur.mast@gmail.com wrote: i think there is no use of discussing this ques.. On Sun, Sep 20, 2009 at 2:25 PM, eSKay