All possible combinations algorithm

Sasha Pachev sasha at surveyz.com
Fri Jun 17 07:06:36 MDT 2005


 > 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 will probably break it)

It fails if your array has duplicates. Aside from that, think about the plight 
of having to port it to C (something you would want to do for a O(N!) 
algorithm). Also, what if your array had objects instead of strings?

The "inspirational" part of a solution is usually about only 10% of the work. 
The rest is debugging, testing, error checking, and other forms of necessary 
tedium.

Perhaps half-hour was an optimisitic estimate after all...

-- 
Sasha Pachev
AskSasha Linux Consulting
http://www.asksasha.com




More information about the PLUG mailing list