nextPermutation and ranges
H. S. Teoh
hsteoh at quickfur.ath.cx
Thu Feb 7 12:31:13 PST 2013
On Thu, Feb 07, 2013 at 09:24:24PM +0100, bearophile wrote:
> H. S. Teoh:
>
> >any implementation based on factorial would have to address the issue
> >of how to handle the exponential growth. I think it'sunacceptable for
> >the standard library to support permutations only up to ranges of 20
> >elements or less, because 21! > 2^64.
>
> What are the use cases of generating the permutations of a set of
> items higher than abot 20? (in my code I don't remember having to
> permute more than few items.)
Combinatorial puzzles come to mind (Rubik's cube solvers and its ilk,
for example). Maybe other combinatorial problems that require some kind
of exhaustive state space search. Those things easily go past 20! once
you get beyond the most trivial cases.
> One thing I was forgetting: thank you for your work H. S. Teoh.
[...]
You're welcome.
T
--
Never ascribe to malice that which is adequately explained by incompetence. -- Napoleon Bonaparte
More information about the Digitalmars-d
mailing list