Diagram illustrating the Greedy Algorithm used for ATM cash withdrawals

In payment systems, the Greedy Algorithm is used to give the customer the minimum number of banknotes when cash is withdrawn from an ATM.

The algorithm used varies from bank to bank. The reason is that the cash-holding capacity of the ATMs used and the transaction volume carried out through the ATMs differ.

For example, at a bank where all ATMs are dual-tower machines (containing cash in 2 units: recycler and dispenser), the ATMs hold higher amounts of cash, so using the Greedy algorithm is less critical. However, for a bank whose ATMs have low cash-holding capacity and high transaction volume, using the Greedy Algorithm would be beneficial.

Below are a few scenarios used in the step of dispensing cash to the customer during withdrawal transactions:

  • Equal Distribution Algorithm
  • Max. Variety Algorithm
  • Minimum Banknote Algorithm (Greedy Algorithm)

Equal Distribution Algorithm:

In this algorithm, all the banknote denominations given to the customer are kept as equal as possible. For example, when withdrawing 1000 TL from an ATM;

  • 6 x 100 TL
  • 5 x 50 TL
  • 5 x 20 TL
  • 5 x 10 TL are dispensed.

Max. Variety Algorithm:

In this algorithm, the withdrawal is carried out by giving the customer banknotes from all denominations. For example, when withdrawing 1000 TL from an ATM;

  • 9 x 100 TL
  • 1 x 50 TL
  • 2 x 20 TL
  • 1 x 10 TL are dispensed.

Minimum Banknote Algorithm (Greedy Algorithm):

In this algorithm, the customer is given the minimum number of banknotes. For example, when withdrawing 1000 TL from an ATM;

  • 10 x 100 TL are dispensed. (When the 100 TL notes run out, the process continues with the other denominations.)

In short, when dispensing cash from an ATM, it would be more beneficial to apply a mixed algorithm rather than a single one.

My recommendation on this subject would be to use the algorithm below.

It would be more appropriate to first calculate the lowest-denomination portion that can be given to the customer (for example, the last 100 TL), dispense that amount in smaller notes, and dispense the remaining amount in the highest-denomination banknotes.

For example, when a customer wants to withdraw 1000 TL;

  • 4 x 200 TL
  • 1 x 100 TL
  • 1 x 50 TL
  • 2 x 20 TL
  • 1 x 10 TL — the payment is made to the customer in this distribution.

In short, although banks' rules on this matter vary, the goal of all banks is to increase customer satisfaction and keep the satisfaction level high.