Oh, wait, never mind. I got my test cases backwards! The factorial choose function was 62 seconds and the recursive choose function was 32 seconds. It's all good! :)
Thanks, again everybody. On Mon, May 24, 2010 at 11:24 AM, Chris Carton <[email protected]> wrote: > Thank you, everyone for the advice. > > I modified my code to apply the % 100003 throughout and I also added a > cache for the binomials. This improved the running time for the large set > to ~ 30 seconds! Much better. :) > > However, I found in my tests that the recursive definition of the choose > function was actually *slower*. Using the factorial version the running > time was 32 seconds, but when I tried the recursive version it took 62 > seconds. I assume that is because the overhead of the recursive functions > in python is too much? (Compared to the factorial library function which is > implemented in C I suspect). > > > -- You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-code?hl=en.
