Cashier's Algorithm