# All possible combinations algorithm

Matt Bowler matt at mattbowler.com
Wed Jun 15 09:17:42 MDT 2005

```come on, josh...it is finals week after all...give him a break...

> -------- Original Message --------
> Subject: RE: All possible combinations algorithm
> From: "Josh Coates" <jcoates at archive.org>
> Date: Wed, June 15, 2005 8:45 am
> To: "Provo Linux Users Group Mailing List" <plug at plug.org>
>
> >Given an array of elements (with an unknown length), I need to find all
> >possible combinations of that array.
>
> um...dude - this is kind of a silly question.
>
> is this one of your homework problems..?
>
> Josh Coates
> www.jcoates.org
>
> -----Original Message-----
> From: plug-bounces at plug.org [mailto:plug-bounces at plug.org]On Behalf Of
> Dan Wilson
> Sent: Tuesday, June 14, 2005 11:03 PM
> To: plug at plug.org
> Subject: All possible combinations algorithm
>
>
> Ok folks, I need the help of some good mathematicians/programmers.  I
> know some of you are very good with this type of stuff and I am not.
>
> Given an array of elements (with an unknown length), I need to find all
> possible combinations of that array.  Say I have an array with the
> values of:
>
> 'hey', 'you', and 'guys'
>
> I need an algorithm that allows me to combine each of these array
> elements into a string... all combinations:
>
> "hey you guys"
> "hey guys you"
> "you hey guys"
> "you guys hey"
> "guys hey you"
> "guys you hey"
>
> I'm sure I could pound this out, but I'm sure some of you have done this
> in the past or know a specific algorithm that would do the trick.
>
> Thanks!
>
> -Dan
>
> PS. This is for PHP, so if you have code examples, that would be even
> better.
>
> .===================================.
> | This has been a P.L.U.G. mailing. |
> |      Don't Fear the Penguin.      |
> |  IRC: #utah at irc.freenode.net   |
> `==================================='
>
>
>
> .===================================.
> | This has been a P.L.U.G. mailing. |
> |      Don't Fear the Penguin.      |
> |  IRC: #utah at irc.freenode.net   |
> `==================================='

```