in reply to Re: Speeding permutation counting
in thread Speeding permutation counting

BrowserUk,
Once I understood the problem, I came up with a solution very similar to yours. When I logged in this morning, I noticed that you had already came up with the idea. Why does work have to get in the way of fun?

I doubt there would be a speed improvement but I am pretty sure you only have to count '01' since '10' is just a reflection. Additionally, you should only need to calculate ('11' and '00') or ('11' and '10') or ('00' and '10'). The remaining two can be obtained with math.

Cheers - L~R

Replies are listed 'Best First'.
Re^3: Speeding permutation counting
by albert (Monk) on Jul 21, 2007 at 23:38 UTC
    In my problem '01' is different than '10', and I need to count them separately. Still, your point of not needing to count the last is well taken, as I can count 3, and thereby know the 4th. However, by doing this, I'm not seeing any significant performance gains, and it may be a bit slower.
    Rate browser+LR browserUK browser+LR 19055/s -- -2% browserUK 19509/s 2% --
    Code for benchmarking...