home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / os / msdos / programm / 10806 < prev    next >
Encoding:
Text File  |  1992-11-20  |  1.3 KB  |  37 lines

  1. Newsgroups: comp.os.msdos.programmer
  2. Path: sparky!uunet!caen!sdd.hp.com!apollo.hp.com!netnews
  3. From: holbrook@apollo.HP.COM (Alan R. Holbrook)
  4. Subject: 'All Possible Combinations' Algorithm
  5. Sender: usenet@apollo.hp.com (Usenet News)
  6. Message-ID: <By109I.HEt@apollo.hp.com>
  7. Date: Fri, 20 Nov 1992 17:51:17 GMT
  8. Nntp-Posting-Host: jurgen.ch.apollo.hp.com
  9. Organization: Hewlett-Packard Company, Chelmsford, MA
  10. Keywords: combinations
  11. Lines: 24
  12.  
  13. Can someone provide me with an algorithm suitable for writing a program
  14. to dump all possible combinations of 'n' elements taken 'm' at a time?
  15. That is, given the string 'abcdefghijklmnop', I'd like to be able to produce
  16. all possible combinations of, say, 'abcde', then of 'abcdf', or of 'cfilnop'
  17. then 'aceghilmp', etc.  I think you get the idea.
  18.  
  19. I'm sure anyone who has taken any statistics knows the formula for doing
  20. this, but I never took any statistics.
  21.  
  22. I know, by the way, that I'm talking ._!LOTS!_. of combinations.  I don't
  23. really need to be able to print or file all of them, I just need to know
  24. how to.
  25.  
  26. Oh, yeah, in case anyone is tempted to wonder, this isn't for a class or any
  27. other kind of assignment.  Actually, I need to be able to demonstrate a point
  28. to my wife...
  29.  
  30. Thanks,
  31. Alan Holbrook
  32. holbrook@apollo.hp.com
  33. No .sig, I just post on impulse.
  34.  
  35.  
  36.  
  37.