52 choose 7

Discussion in 'C++' started by bob@coolgroups.com, Oct 4, 2005.

  1. Guest

    Let's say you want to iterate through all of the possible combinations
    that occur when you choose 7 cards from a fifty two card deck. Anyone
    know the best way to do this?

    Thanks.
     
    , Oct 4, 2005
    #1
    1. Advertising

  2. * :
    > Let's say you want to iterate through all of the possible combinations
    > that occur when you choose 7 cards from a fifty two card deck. Anyone
    > know the best way to do this?


    Define

    * "best"

    * what the C++ question is.

    --
    A: Because it messes up the order in which people normally read text.
    Q: Why is it such a bad thing?
    A: Top-posting.
    Q: What is the most annoying thing on usenet and in e-mail?
     
    Alf P. Steinbach, Oct 4, 2005
    #2
    1. Advertising

  3. Guest Guest

    > Define
    >
    > * "best"


    asymptotically efficient...


    jeez I really dislike this kind of ppl
     
    Guest, Oct 4, 2005
    #3
  4. wrote:
    >>Define
    >>
    >> * "best"

    >
    >
    > asymptotically efficient...


    Memory-efficient or time-efficient?

    > jeez I really dislike this kind of ppl


    Which kind is that?
     
    Victor Bazarov, Oct 4, 2005
    #4
  5. * <>:
    > > Define
    > >
    > > * "best"

    >
    > asymptotically efficient...


    That's a no-brainer, if you think about it (oops).


    > jeez I really dislike this kind of ppl


    And the C++ question was?

    Btw., don't multipost articles; read up on netiquette, please.

    --
    A: Because it messes up the order in which people normally read text.
    Q: Why is it such a bad thing?
    A: Top-posting.
    Q: What is the most annoying thing on usenet and in e-mail?
     
    Alf P. Steinbach, Oct 4, 2005
    #5
  6. mlimber Guest

    wrote:
    > > Define
    > >
    > > * "best"

    >
    > asymptotically efficient...
    >
    >
    > jeez I really dislike this kind of ppl


    That's not necessarily correct, and besides I think Alf's point was
    that the original post was off-topic here. See this FAQ:

    http://www.parashift.com/c -faq-lite/how-to-post.html#faq-5.9

    Cheers! --M
     
    mlimber, Oct 4, 2005
    #6
  7. The question makes me think you haven't thought about the problem for
    long enough to have yet moved into the "so how do I implement this?"
    range. What you're asking is algorithmic analysis, not
    language-specific.

    That said, I'd suggest you start thinking about whether you really need
    this massive set. With 133,784,560 different elements in the set,
    you're talking about a nontrivial amount of data. If your ultimate
    goal is to look through the set looking for the frequency certain hands
    come up, you're going to be far better served solving your problem via
    math and statistics instead of exhaustive analysis.

    Once you understand your problem well, then start thinking about what
    language to use to solve your problem. Then we'll be happy to help if
    you have questions about how to turn your algorithm into C++.

    But as is, you don't seem to understand your problem very well, and
    we're not going to understand your problem for you.
     
    Robert J. Hansen, Oct 4, 2005
    #7
  8. Ron Natalie Guest

    wrote:
    > Let's say you want to iterate through all of the possible combinations
    > that occur when you choose 7 cards from a fifty two card deck. Anyone
    > know the best way to do this?
    >

    52 ? 7 if you are using APL.
     
    Ron Natalie, Oct 4, 2005
    #8
  9. David White Guest

    Robert J. Hansen wrote:
    > The question makes me think you haven't thought about the problem for
    > long enough to have yet moved into the "so how do I implement this?"
    > range. What you're asking is algorithmic analysis, not
    > language-specific.
    >
    > That said, I'd suggest you start thinking about whether you really
    > need this massive set. With 133,784,560 different elements in the
    > set, you're talking about a nontrivial amount of data.


    But you don't necessarily need to keep it all. Depending on what you are
    doing you might only need to look at each one and throw it away. On today's
    PCs, 133 million hands can be analysed pretty quickly.

    > If your
    > ultimate goal is to look through the set looking for the frequency
    > certain hands come up, you're going to be far better served solving
    > your problem via math and statistics instead of exhaustive analysis.


    I don't think so. Just for fun I once computed the probabilities of various
    poker hands using maths alone, but it's very easy to make mistakes that way,
    and how do you prove that you didn't make a mistake? Sometime after writing
    them all out in a nice table, I discovered that the probability I'd
    calculated for getting two pairs when dealt five cards was a factor of 2 out
    (1/21 instead of 1/10.5) because I had made a mistake. On the other hand,
    it's hard to go wrong if you simply deal every possible hand and count the
    two-pairs among them. An additional advantage is that you can make the
    criteria that constitute a matching hand anything you like without having to
    work out each time how to work it out.

    DW
     
    David White, Oct 5, 2005
    #9
  10. The original post was:

    <quote>
    Let's say you want to iterate through all of the possible combinations
    that occur when you choose 7 cards from a fifty two card deck. Anyone
    know the best way to do this?
    </quote>

    <> wrote in message
    news:4342ca5c$0$29556$...
    >> Define
    >>
    >> * "best"

    >
    > asymptotically efficient...


    The problem of choosing 7 cards out of 52 has nothing to do with
    asymptotical efficiency.

    Ali
     
    =?utf-8?Q?Ali_=C3=87ehreli?=, Oct 5, 2005
    #10
  11. "Ali Çehreli" <> wrote in message
    news:dhv8c9$bo6$...
    > The original post was:
    >
    > <quote>
    > Let's say you want to iterate through all of the possible combinations
    > that occur when you choose 7 cards from a fifty two card deck. Anyone
    > know the best way to do this?
    > </quote>
    >
    > <> wrote in message
    > news:4342ca5c$0$29556$...
    >>> Define
    >>>
    >>> * "best"

    >>
    >> asymptotically efficient...

    >
    > The problem of choosing 7 cards out of 52 has nothing to do with
    > asymptotical efficiency.


    Never mind; I misread what I quoted :(

    Ali
     
    =?utf-8?Q?Ali_=C3=87ehreli?=, Oct 5, 2005
    #11
  12. Zara Guest

    On 4 Oct 2005 10:50:10 -0700, wrote:

    >Let's say you want to iterate through all of the possible combinations
    >that occur when you choose 7 cards from a fifty two card deck. Anyone
    >know the best way to do this?
    >
    >Thanks.


    How about using for(..) loops?
    It is trivial, if you think a little.
    Do you homework
     
    Zara, Oct 5, 2005
    #12
  13. In message <>, Alf P. Steinbach
    <> writes
    >* <>:
    >> > Define
    >> >
    >> > * "best"

    >>
    >> asymptotically efficient...

    >
    >That's a no-brainer, if you think about it (oops).


    In the limit as 52 tends to 52, or as 7 tends to 7? ;-)

    --
    Richard Herring
     
    Richard Herring, Oct 5, 2005
    #13
  14. Guest Guest

    > Memory-efficient or time-efficient?

    you should ask who started the thread. i'd say both
     
    Guest, Oct 5, 2005
    #14
    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. warstar
    Replies:
    12
    Views:
    691
  2. Karl Shifflett

    Web Setup Choose Web To Install In

    Karl Shifflett, Jan 13, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    336
    Karl Shifflett
    Jan 13, 2004
  3. Matthew Belk
    Replies:
    1
    Views:
    352
    Chris Jackson
    Feb 23, 2004
  4. Vaughn

    Why choose SQL Server or Access?

    Vaughn, Apr 19, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    397
    Curt_C [MVP]
    Apr 19, 2004
  5. =?Utf-8?B?Um9ic29uIENhcnZhbGhvIE1hY2hhZG8=?=

    How to choose what control will receive action

    =?Utf-8?B?Um9ic29uIENhcnZhbGhvIE1hY2hhZG8=?=, Aug 11, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    282
    =?Utf-8?B?Um9ic29uIENhcnZhbGhvIE1hY2hhZG8=?=
    Aug 11, 2004
Loading...

Share This Page