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

Discussion in 'C++' started by Balog Pal, Jan 11, 2010.

  1. Balog Pal

    Balog Pal Guest

    <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.
    Balog Pal, Jan 11, 2010
    #1
    1. Advertising

  2. On 2010-01-11, Balog Pal <> 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.)
    Andrew Poelstra, Jan 11, 2010
    #2
    1. Advertising

  3. Balog Pal

    Balog Pal Guest

    "Andrew Poelstra" <>

    > (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.
    Balog Pal, Jan 11, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ike
    Replies:
    3
    Views:
    1,034
    opalinski from opalpaweb
    Jan 23, 2006
  2. Gunnar G

    find all permutations

    Gunnar G, Sep 12, 2004, in forum: C++
    Replies:
    2
    Views:
    484
    Kai-Uwe Bux
    Sep 12, 2004
  3. =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?=

    vs2005 publish website doing bad things, bad things

    =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?=, Oct 25, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    589
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Oct 25, 2006
  4. Alf P. Steinbach
    Replies:
    2
    Views:
    1,418
    John H.
    Jan 11, 2010
  5. Eric Böse-Wolf
    Replies:
    6
    Views:
    1,031
    Eric Böse-Wolf
    Jan 18, 2010
Loading...

Share This Page