nextPermutation and ranges

Era Scarecrow rtcvb32 at yahoo.com
Fri Feb 8 18:55:15 PST 2013


On Saturday, 9 February 2013 at 01:25:58 UTC, John Colvin wrote:
> This is a fair point. Being able to obtain the kth permutation 
> of a large set would indeed be useful, even if iteration is not 
> feasible. For example, you might want to examine the k=2^n  
> perturbations, as you have some a priori knowledge that they 
> contain the solution you're looking for.
>
> In that case we'd want to be able to index with an effectively 
> arbitrary size index. I don't have any experience with bigint 
> but I presume it's the correct tool for the job.

  BigInt would seem the easiest to implement as things presently 
stand, as it should only require you to modify the type(s) for 
the index while the remainder is the same.

  Using cent would need require the 128bit type implemented and 
the array one would take a lot of work and maybe change the whole 
algorithm to try and compensate for it.

  Regardless I'd like to see cent implemented. Hmmm although 
there's a predetermined definition for the 128bit type, was there 
for a 256bit type? Although that might be getting ahead of what 
we may need them for.


More information about the Digitalmars-d mailing list