help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding all subsets


From: Søren Hauberg
Subject: Re: Finding all subsets
Date: Tue, 05 Jul 2005 16:09:59 +0200
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050404)

Mike Miller wrote:
On Tue, 5 Jul 2005, Soren Hauberg wrote:

I can't seem to wrap my mind around a very simple problem.
I need to find all possible subsets of a set.
Example:
All possible subsets of
[1, 2, 3]
is
{ [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3] }


Is [] (null set) also a subset?
I guess it is, I simply forgot to list it.

An n-vector has 2^n subsets, if the null set is included.

I'm not sure what the best way is to extract the subsets and I don't know how you want them organized in matrices or whatever.
The best way would be a cell array of vectors (octave represents sets as vectors).


Mike
Thanks,
Søren



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]