Help with Algorithm chinese auction

Posted by sam munkes on Stack Overflow See other posts from Stack Overflow or by sam munkes
Published on 2010-04-02T22:31:05Z Indexed on 2010/04/02 22:33 UTC
Read the original article Hit count: 1015

Filed under:
|

Hi, i am designing a Chinese auction website.

Tickets ($5, $10 & $20) are sold either individually, or via packages to receive discounts. There are various Ticket packages for example:

  1. 5-$5 tickets = receive 10% off
  2. 5-$10 tickets = receive 10% off
  3. 5-$20 tickets = receive 10% off
  4. 5-$5 tickets + 5-$10 tickets + 5-$20 tickets = receive 15% off

When users add tickets to their cart, i need to figure out the cheapest package(s) to give them. the trick is that if a user adds 4-$5 tickets + 5-$10 tickets + 5-$20 tickets, it should still give him package #3 since that would be the cheapest for him.

Any help in figuring out a algorithm to solve this, or any tips would be greatly appreciate it.

thanks

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about algorithm-design