Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > 52 choose 7

Reply
Thread Tools

52 choose 7

 
 
bob@coolgroups.com
Guest
Posts: n/a
 
      10-04-2005
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.

 
Reply With Quote
 
 
 
 
Alf P. Steinbach
Guest
Posts: n/a
 
      10-04-2005
* http://www.velocityreviews.com/forums/(E-Mail Removed):
> 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?
 
Reply With Quote
 
 
 
 
Guest
Posts: n/a
 
      10-04-2005
> Define
>
> * "best"


asymptotically efficient...


jeez I really dislike this kind of ppl


 
Reply With Quote
 
Victor Bazarov
Guest
Posts: n/a
 
      10-04-2005
(E-Mail Removed) wrote:
>>Define
>>
>> * "best"

>
>
> asymptotically efficient...


Memory-efficient or time-efficient?

> jeez I really dislike this kind of ppl


Which kind is that?
 
Reply With Quote
 
Alf P. Steinbach
Guest
Posts: n/a
 
      10-04-2005
* <(E-Mail Removed)>:
> > 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?
 
Reply With Quote
 
mlimber
Guest
Posts: n/a
 
      10-04-2005
(E-Mail Removed) 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-lit...t.html#faq-5.9

Cheers! --M

 
Reply With Quote
 
Robert J. Hansen
Guest
Posts: n/a
 
      10-04-2005
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.

 
Reply With Quote
 
Ron Natalie
Guest
Posts: n/a
 
      10-04-2005
(E-Mail Removed) 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.

 
Reply With Quote
 
David White
Guest
Posts: n/a
 
      10-05-2005
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


 
Reply With Quote
 
=?utf-8?Q?Ali_=C3=87ehreli?=
Guest
Posts: n/a
 
      10-05-2005
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>

<(E-Mail Removed)> wrote in message
news:4342ca5c$0$29556$(E-Mail Removed) ...
>> Define
>>
>> * "best"

>
> asymptotically efficient...


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

Ali

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shortcut to SP2's "Choose a wireless network" dialog box? =?Utf-8?B?TWljaGFlbCBBLiBMb3dyeQ==?= Wireless Networking 4 02-14-2008 05:48 PM
Need help to choose my line =?Utf-8?B?UmFtZXNo?= Microsoft Certification 2 08-03-2005 09:32 PM
How do I choose which adapter to use for Internet access? Mark P Wireless Networking 1 12-07-2004 10:06 AM
Which To Choose =?Utf-8?B?VG9tQg==?= Wireless Networking 3 11-06-2004 02:49 PM
which WLAN access point to choose Remco Meeder Wireless Networking 5 09-27-2004 11:15 PM



Advertisments