Posted: Sun Dec 29, 2002 10:51 am
i see...
you do not have to test ALL n! possibilities... my idea would be to use a stack and explore the possibilities like a tree... BUT you can "go back" as soon as the sum of bottle movement gets greater than MAX (the temp max number of bottle movement).. not sure i'm being very clear :/
example:
if you know a way to sort the bins with 10 bottle movements, and you have 10 bins:
bin 1 has 5 green bottles
bin 2 has 6 brown bottles
all the possibilities that put brown bottles in bin 1 and green bottles in bin 2 can be eliminated AT ONCE because they have at least 5+6=11 bottle movements.. that's what i called "go back" when you explore the tree of possibilities....
there might be a better solution but i don't know it...
if anyone knows it please let me know
you do not have to test ALL n! possibilities... my idea would be to use a stack and explore the possibilities like a tree... BUT you can "go back" as soon as the sum of bottle movement gets greater than MAX (the temp max number of bottle movement).. not sure i'm being very clear :/
example:
if you know a way to sort the bins with 10 bottle movements, and you have 10 bins:
bin 1 has 5 green bottles
bin 2 has 6 brown bottles
all the possibilities that put brown bottles in bin 1 and green bottles in bin 2 can be eliminated AT ONCE because they have at least 5+6=11 bottle movements.. that's what i called "go back" when you explore the tree of possibilities....
there might be a better solution but i don't know it...
if anyone knows it please let me know