home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / softsys / matlab / 126 < prev    next >
Encoding:
Text File  |  1993-01-24  |  844 b   |  23 lines

  1. Newsgroups: comp.soft-sys.matlab
  2. Path: sparky!uunet!think.com!yale.edu!news.yale.edu!wayne
  3. From: wayne@econ.yale.edu (Kevin Wayne)
  4. Subject: Enumerating Combinations
  5. Message-ID: <1993Jan23.214452.26779@news.yale.edu>
  6. Sender: news@news.yale.edu (USENET News System)
  7. Nntp-Posting-Host: aida.econ.yale.edu
  8. Organization: Economics Department, Yale University, New Haven, Ct.
  9. Date: Sat, 23 Jan 1993 21:44:52 GMT
  10. Lines: 11
  11.  
  12. I want to enumerate all combinations of n items taken p at a time for
  13. arbitrary n, p<=n.
  14.  
  15. (i.e., for (n,p)=(5,3) generate a sequence of vectors:
  16.     [1 2 3], [1 2 4], [1 2 5], [1 3 4], [1 3 5], [1 4 5],
  17.     [2 3 4], [2 3 5], [2 4 5], [3 4 5] )
  18.  
  19. Obviously, the computational effort will increase exponentially, but I only
  20. need to use it for relatively small n.
  21.  
  22. If anyone has written such code, please send e-mail. Thanks in advance.
  23.