Re: All possible combinations algorithm

2005-06-17 Thread Sasha Pachev
> A half hour? Sasha, you're loosing your touch! People are often unhappy when I tell them how long it would take me to code something up. However, I do have a pretty good record of delivering on time. > Here's a quicky PHP version: > (note: it does no input validation--non or empty array wil

Re: All possible combinations algorithm

2005-06-16 Thread Nicholas Leippe
On Wednesday 15 June 2005 03:03 pm, Sasha Pachev wrote: > As was already noted, a recursive solution is perhaps the easiest way to > solve the problem. It would take me about 30 minutes I do not have today to > code/debug one, so I'll just give you a general idea - make a function that > can give y

Re: All possible combinations algorithm

2005-06-16 Thread Michael Halcrow
On Tue, Jun 14, 2005 at 11:03:29PM -0600, Dan Wilson wrote: > PS. This is for PHP, so if you have code examples, that would be > even better. For those who are interested in further exploring this problem in a real programming language, I found this excellent little collection of routines: http:/

RE: All possible combinations algorithm

2005-06-15 Thread Sasha Pachev
> I already had a solution... but I felt it was bruit-force. I was wanting > a more optimized solution/algorithm... and was having a brain-fart. > Sorry I didn't indicate that. Dan: The problem of permutations cannot possibly have a better than O(N!) solution - you do need to spit out N! worth

Re: All possible combinations algorithm

2005-06-15 Thread Dave Smith
Way to sneak in a Spiderman 2 quote, Mr. Jameson! :) --Dave > libel, to be perfectly accurate... > > On 6/15/05, Stuart Jansen <[EMAIL PROTECTED]> wrote: >> On Wed, 2005-06-15 at 10:48 -0600, Ryan Byrd wrote: >> > Stuart's presents a tough online character, doesn't he?. Don't worry, >> > he's muc

Re: All possible combinations algorithm

2005-06-15 Thread Roberto Mello
On Wed, Jun 15, 2005 at 10:57:20AM -0600, Ryan Byrd wrote: > libel, to be perfectly accurate... queue Jonah from spider-man... -Roberto P.S.: Top-posting and no trimming is lame. very lame. P.S.2: /me waves to Ryan accross cube-space. -- ( This message in Stereo where available ) .

Re: All possible combinations algorithm

2005-06-15 Thread Stuart Jansen
On Wed, 2005-06-15 at 10:57 -0600, Ryan Byrd wrote: > libel, to be perfectly accurate... Oh, uhm, yeah, oops. You're right... Libel, you fiend! -- Stuart Jansen e-mail/jabber: [EMAIL PROTECTED] "XML is like violence: if it doesn't solve your problem, you aren't using enough o

RE: All possible combinations algorithm

2005-06-15 Thread Dan Wilson
On Wed, 2005-06-15 at 10:05 -0600, Stuart Jansen wrote: > 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 i

Re: All possible combinations algorithm

2005-06-15 Thread Ryan Byrd
libel, to be perfectly accurate... On 6/15/05, Stuart Jansen <[EMAIL PROTECTED]> wrote: > On Wed, 2005-06-15 at 10:48 -0600, Ryan Byrd wrote: > > Stuart's presents a tough online character, doesn't he?. Don't worry, > > he's much nicer in real life. > > Slander! > > -- > Stuart Jansen

Re: All possible combinations algorithm

2005-06-15 Thread Stuart Jansen
On Wed, 2005-06-15 at 10:48 -0600, Ryan Byrd wrote: > Stuart's presents a tough online character, doesn't he?. Don't worry, > he's much nicer in real life. Slander! -- Stuart Jansen e-mail/jabber: [EMAIL PROTECTED] "XML is like violence: if it doesn't solve your problem, you

Re: All possible combinations algorithm

2005-06-15 Thread Ryan Byrd
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: All possible combinations algorithm

2005-06-15 Thread Josh Coates
sjansen: >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. no sta

RE: All possible combinations algorithm

2005-06-15 Thread Stuart Jansen
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 questio

Re: All possible combinations algorithm

2005-06-15 Thread Jordan Gunderson
Here it is with tardmode taken off. The wording is a little better. Hey Dan, Thanks for the math question. If the number of elements is E, the number of possible arrangements is equal to the E! (read "E factoral"). It's E times all of the integers between E and zero. Be careful though, be

RE: All possible combinations algorithm

2005-06-15 Thread Dan Wilson
On Wed, 2005-06-15 at 08:17 -0700, Matt Bowler wrote: > come on, josh...it is finals week after all...give him a break... Yeah... come on Josh, give me a break! However, I haven't been in school for over 4 years. I just didn't word my email correctly. I'm sure I'm the only one who has ever done

RE: All possible combinations algorithm

2005-06-15 Thread Dan Wilson
On Wed, 2005-06-15 at 08:45 -0600, Josh Coates wrote: > >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..? Wow... leave it Josh to bring so

Re: All possible combinations algorithm

2005-06-15 Thread Jordan Gunderson
Dan Wilson wrote: 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

RE: All possible combinations algorithm

2005-06-15 Thread Matt Bowler
come on, josh...it is finals week after all...give him a break... > Original Message > Subject: RE: All possible combinations algorithm > From: "Josh Coates" <[EMAIL PROTECTED]> > Date: Wed, June 15, 2005 8:45 am > To: "Provo Linux Users Group

RE: All possible combinations algorithm

2005-06-15 Thread Josh Coates
[EMAIL PROTECTED] Behalf Of Dan Wilson Sent: Tuesday, June 14, 2005 11:03 PM To: plug@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 el

Re: All possible combinations algorithm

2005-06-14 Thread Andrew McNabb
On Tue, Jun 14, 2005 at 11:25:52PM -0600, Andrew McNabb wrote: > I would do this recursively. My PHP stinks, but something like this: > > function hello($array) > { > foreach ($array as $i => $value) { > unset ($array[$i]); > print $element . hello($array); >

Re: All possible combinations algorithm

2005-06-14 Thread Andrew McNabb
On Tue, Jun 14, 2005 at 11:03:29PM -0600, Dan Wilson wrote: > 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 combinat

All possible combinations algorithm

2005-06-14 Thread Dan Wilson
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', '