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