View Single Post
  #74  
Old 12-28-2006, 03:17 PM
Gullanian Gullanian is offline
Senior Member
 
Join Date: Dec 2006
Posts: 1,748
Default Re: 279Mill a second.....

Where intToIndexArr_L1 holds 8 integers. The first holding the number of indexes to return, and the next 7 the indexes of on bits.

Then the way mine works is by applying an algorithm on the sorted cards into a combination ID to look up in O(1) access time. Algorithm works by summating precomputed choose summations to work out the index.

Also please note for the test I gave, I apply the sorting algorithm even though I don't need to, I could just keep a combination counter incrementing on each iteration and use that for an index lookup, this speeds it up hugely. However, in real world cases the hand needs to be sorted, which is why I have left it in.
Reply With Quote