in reply to Re: amount permutations
in thread amount permutations

This does appear to be a bit faster and looks like it will work for what we need it to do. Have to do a bit more testing with our data. One question though, I notice it produces a lot more combinations, any idea how I could calculate the number of combinations from the number of records searched? That way I could output some status information to let them know how far they are into the search. Thanks!

Replies are listed 'Best First'.
Re: Re: Re: amount permutations
by Limbic~Region (Chancellor) on Mar 04, 2004 at 20:01 UTC
    gr0k,
    Well, it depends on what answer you want. To be honest you were checking the same number of combinations as me. The difference is you weren't counting ones that you discarded. There was effort spent on determing they could be discarded though - which is why I included all combinations.

    In order to make my $count look like your count will require more work - and make the process slower. If you want - you can change the position of $count++ to after the for loop. There you would only be counting the number of combinations that did not have a duplicate number in them and whose combined value was not greater than the target sum.

    I would recommend in the real problem removing all candidates that were already larger than the target number.

    Cheers - L~R