in reply to Re^2: Challenge: Twist On Bin Packing
in thread Challenge: Twist On Bin Packing

Smallest to largest won't always give the maximum number of bins. Take 1,1,1,2,2,3,4,6,7,7 for example.

Filling them smalles to largest you get 4 bins:
1,1,1,2,2,3
4,6
7
7

But you can get 5 bins by filling it:
6,1,1,1
2,2,3
7
7
4

Replies are listed 'Best First'.
Re^4: Challenge: Twist On Bin Packing
by japhy (Canon) on Apr 07, 2006 at 20:06 UTC
    Well, crap. You should un-anonymize yourself so I know who to hatethank.

    Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
    How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart
Re^4: Challenge: Twist On Bin Packing
by moklevat (Priest) on Apr 07, 2006 at 21:31 UTC
    Ack! Neat! Can you describe the algorithm?
      No, I'm still trying to work one out :)

      I figured if the smallest to largest wasn't going to work, it would likely be due to combinations of numbers where the smaller numbers add up to 10, but using larger numbers add up to 9.

      A little trial and error found it.


      I'm kinda thinking about something along the lines of "Use all the 1s to add up to 10, use all the 2s to add up 9, use all the 3s to add up 8, etc.", but I haven't been able to determine whether that is always going to work or not.