nextPermutation and ranges
H. S. Teoh
hsteoh at quickfur.ath.cx
Thu Feb 7 13:52:01 PST 2013
On Thu, Feb 07, 2013 at 09:42:34PM +0100, bearophile wrote:
> H. S. Teoh:
>
> >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.
>
> I know many situations/problems where you have more than 20! cases,
> but in those problems you don't iterate all permutations, because the
> program takes ages to do it. In those programs you don't use
> nextPermutation, you scan the search space in a different and smarter
> way.
>
> I don't know of any use case for permuting so large sets of items.
[...]
It depends, sometimes in complex cases you have no choice but to do
exhaustive search. I agree that it's very rare, though.
T
--
If creativity is stifled by rigid discipline, then it is not true creativity.
More information about the Digitalmars-d
mailing list