On Monday, 20 August 2012 at 00:13:41 UTC, maarten van damme wrote:
I'm using a static array.

 Good good..

I'm hesitating though if I should store possibilities in a precalculated array or calculate them in-place. If I precalculate the possibilities I'd have to copy them over and over so I don't know if it's smart.

Depends. Do you plan on doing more than brute force? Having it bulk copy them may not be that bad if it's all in one place, and if you do it like that you have all the combinations that carry forward to the next level and if you back out it undoes them all automatically.

In my updated code it gets it done in about 5 seconds compared to 12. To get it even faster I would have to implement a third algorithm to help reduce possibilities, the stored results then become a must compared to on-the-fly.

Going even further I could even store a filled-in value as an array with one possibilities...

As long as you can tell it apart for it to work, that's up to you.

Reply via email to