Article View: comp.os.msdos.programmer
Article #6594'All Possible Combinations' Algorithm
From: Alan R. Holbrook
Date: Fri, 20 Nov 1992 17:51
Date: Fri, 20 Nov 1992 17:51
21 lines
1336 bytes
1336 bytes
Can someone provide me with an algorithm suitable for writing a program to dump all possible combinations of 'n' elements taken 'm' at a time? That is, given the string 'abcdefghijklmnop', I'd like to be able to produce all possible combinations of, say, 'abcde', then of 'abcdf', or of 'cfilnop' then 'aceghilmp', etc. I think you get the idea. I'm sure anyone who has taken any statistics knows the formula for doing this, but I never took any statistics. I know, by the way, that I'm talking ._!LOTS!_. of combinations. I don't really need to be able to print or file all of them, I just need to know how to. Oh, yeah, in case anyone is tempted to wonder, this isn't for a class or any other kind of assignment. Actually, I need to be able to demonstrate a point to my wife... Thanks, Alan Holbrook holbrook@apollo.hp.com No .sig, I just post on impulse.
Technical Details
Message-ID:
<By109I.HEt@apollo.hp.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!caen!sdd.hp.com!apollo.hp.com!netnewsShow Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!caen!sdd.hp.com!apollo.hp.com!netnews From: holbrook@apollo.HP.COM (Alan R. Holbrook) Subject: 'All Possible Combinations' Algorithm Sender: usenet@apollo.hp.com (Usenet News) Message-ID: <By109I.HEt@apollo.hp.com> Date: Fri, 20 Nov 1992 17:51:17 GMT Nntp-Posting-Host: jurgen.ch.apollo.hp.com Organization: Hewlett-Packard Company, Chelmsford, MA Keywords: combinations Lines: 24