Clear questions and runnable code get the best and fastest answer 

PerlMonks 
Re^6: Divide an array into 2 subsets to verify their sum is equal or not. (NP != unsolvable))by LanX (Canon) 
on May 03, 2013 at 19:31 UTC ( #1031952=note: print w/ replies, xml )  Need Help?? 
too long didn't read all, but > > And if kcott or BrowserUK manage to fix their programs, there is a $1,000,000 price on it: > No. Those prizes  and in particular, the P v NP prize  are not up for grabs for finding solutions to particular, restricted or bounded examples of particular NP problems. The prize is for proving that there is a whole class of problems for which there are no solutions. Quite a different matter indeed. Well not in this case!
A consequence of this definition is that if we had a polynomial time algorithm (on a UTM, or any other Turingequivalent abstract machine) for C, we could solve all problems in NP in polynomial time. So finding an algorithm for the partition problem, proven to find a solution (or it's nonexistence) in polynomial time (including for the worst case) means solving P vs NP!!! > Upon analysis, the code required to implement that requirement is identified as being some variation upon one or more of the classical NPComplete problems; and the CS majors and halfwellreads in the room will throw their collective hands up saying, "It can't be done"! Well, bad trained personnel! Problem classes are classified by their worst case. But normally most cases can still be solved pretty fast with already well known algorithms. In praxis stopping after a timeout for few remaining cases is acceptable.
EditEspecially if they calculate an approximate solution. In many cases something like (sum @part1 sum @part2) < min @all is already sufficient.
Cheers Rolf ( addicted to the Perl Programming Language)
In Section
Seekers of Perl Wisdom

