All possible combinations algorithm
ryanbyrd at gmail.com
Wed Jun 15 10:48:10 MDT 2005
Stuart's presents a tough online character, doesn't he?. Don't worry,
he's much nicer in real life. Josh comes off as a jerk sometimes as
well. He, too, is much nicer in real life. :) Also, he's a freakin'
genius. (Stuart's no dummy either.)
Some ideas that might be related:
1- as mentioned, you're trying to find permutations. searching for
"php permutation function" in google returned a few solutions
2- once a particular subset of permutations is found, the remainders
are simply those strings reversed
3- here's an algorithm that I thought of: take the first string and
form permutations that begin with that string. then shift and wrap
through those permutations to get the remainders. for example, with
i) the original ones
ii) shift and wrap
abcd bcda cdab dabc
abdc bdca bcad cadb
acdb cdba dbac bacd
acbd cbda bdac dacb
adbc dbca bcad cadb
adcb dcba cbad badc
On 6/15/05, Stuart Jansen <sjansen at buscaluz.org> wrote:
> On Wed, 2005-06-15 at 09:35 -0600, Dan Wilson wrote:
> > Wow... leave it Josh to bring someone else down in order to make himself
> > look that much more intelligent. That was pretty jerk.
> Oh come off it, if anyone's a jerk it's you for unfairly attacking Josh.
> He asked a valid question. Your question has multiple obvious answers
> that anyone with a CS degree or sufficient real world experience would
> be able to find easily. All of them, unfortunately, is O(n!). The only
> way to discover which is best is benchmarking.
> Now if you were looking for something other than an O(n!) algorithm, you
> should have said so. You should have probably also asked somewhere else.
> The Plug list has only a handful of people that might be able help you,
> ironically one of them is Josh.
> I would suggest instead consulting Dr. Google. Some search terms you
> might find helpful: array permutation efficient algorithm factorial
> Face it, you did a poor job of presenting your question. Josh pointed
> out it was simplistic and wanted to make sure you weren't a student
> trying to get someone else to do his work. When you realized you looked
> foolish, you lashed out instead of clarifying. Hardly Josh's fault.
> Stuart Jansen e-mail/jabber: sjansen at buscaluz.org
> "XML is like violence: if it doesn't solve your problem, you aren't
> using enough of it." - Chris Maden
> BodyID:34571090.2.n.logpart (stored separately)
> | This has been a P.L.U.G. mailing. |
> | Don't Fear the Penguin. |
> | IRC: #utah at irc.freenode.net |
More information about the PLUG