Velocity Reviews > C++ > Re: All Permutations of 10 Things Taken 7 at a Time?

Re: All Permutations of 10 Things Taken 7 at a Time?

Balog Pal
Guest
Posts: n/a

 01-11-2010
<sherman>
> Can you guys direct me to some code that contains
> a way of finding all permutations of n things taken
> k at a time without repetition?
> I am particularly interestd in all permutations of
> the numbers 0,1,2,...,9 taken 7 at a time without repetition.

Well, a brute force method would probably take all numbers 0 to 1e10-1,
filter out anything with a repeated digit then chop the first 3 digits --

Andrew Poelstra
Guest
Posts: n/a

 01-11-2010
On 2010-01-11, Balog Pal <(E-Mail Removed)> wrote:
><sherman>
>> Can you guys direct me to some code that contains
>> a way of finding all permutations of n things taken
>> k at a time without repetition?
>> I am particularly interestd in all permutations of
>> the numbers 0,1,2,...,9 taken 7 at a time without repetition.

>
> Well, a brute force method would probably take all numbers 0 to 1e10-1,
> filter out anything with a repeated digit then chop the first 3 digits --
> the rest is your result.
>

No, you should take all the numbers from 0 to 1e7-1 and do no truncation,
else you will have repetitions.

(But of course in any case brute force is a terrible way to do this.)

Balog Pal
Guest
Posts: n/a

 01-11-2010
"Andrew Poelstra" <(E-Mail Removed)>

> (But of course in any case brute force is a terrible way to do this.)

Of course it is, but you're not supposed to post solution to other's
homework questions, just far hints to allow them discover the solution in
steps.