Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: generating subsets

  • To: mathgroup at smc.vnet.net
  • Subject: [mg21602] Re: generating subsets
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Sun, 16 Jan 2000 22:43:49 -0500 (EST)
  • References: <85s189$aj3@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Michael,

Looking up Subsets in the Help Browser leads to

<< DiscreteMath`Combinatorica`

Subsets[Range[9]]; // Timing

{0.06 Second, Null}

Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565


"Michael Gass" <mgass at bach.math.csbsju.edu> wrote in message
news:85s189$aj3 at smc.vnet.net...
>
> I need an _efficient_  procedure for generating all the subsets
> of a given set.  The procedure should produce output as follows:
>
> subSets[{a,b,c}]
> produces
> {{}, {a}, {b}, {c}, {a,b}, {a,c}, {b,c}, {a,b,c}}
>
> I have written a recursive procedure to do this, but
> it takes quite a while to generate, say, the 512 subsets
> of a 9 element set and I need to work with somewhat larger
> sets.
>
> Thanks
>
> --
> Michael Gass Department of Mathematics
> phone: 320 363-3090                     St. John's University
> email: mgass at csbsju.edu                 Collegeville, MN  56321-3000
>
>
>
>
>



  • Prev by Date: Mathematica???
  • Next by Date: Re: generating subsets
  • Previous by thread: Re: generating subsets
  • Next by thread: Re: generating subsets