http://www.perlmonks.org?node_id=713154


in reply to Re^3: NP-complete sometimes isn't (A benchmark)
in thread NP-complete sometimes isn't

That's a nice approach.

If you want to extend it to negative numbers, it will be less work than you think if you use the right hack. As far as the difference is concerned, having, say, -16 in one partition is exactly the same as having 16 in the other one. So flip all of your signs to positive, then when you've found the solution, delete the appropriate positive ones from one partition while inserting negatives in the other. Voila! Rather than a pervasive logic change you just have to pre-process the list and post-process your answer.

  • Comment on Re^4: NP-complete sometimes isn't (A benchmark)

Replies are listed 'Best First'.
Re^5: NP-complete sometimes isn't (A benchmark)
by Pepe (Sexton) on Sep 24, 2008 at 23:43 UTC
    It's late for this now, but thanks a lot for the effort.