http://qs321.pair.com?node_id=708401


in reply to NP-complete sometimes isn't

and is guaranteed to find the best answer

I think you may have a bug. Given the input set [400 402 521 735 758 191 191 307 679 776 877], your code produces this partition:

[400 402 521 735 758 191] := 3007 [191 307 679 776 877] := 2830

But there is a better partition:

[679 776 307 877 191] := 2830 [400 402 521 758 735] := 2816

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.