Separation of objects into two piles of the same weight

I am sure that you have already heard about this problem. Given the list of natural numbers, is it possible to divide them into two piles of identical amounts? If so, write two lines with objects in each heap.

Is this some kind of known issue? Does he have a name? Is it NP-Complete? If not, what is the quickest solution?

+4
source share
1 answer

This is a Partition issue, which is NP-Complete. This is a variant of the SUM subset.

Which is the fastest, really depends on the data you have. For example, if they are limited, you can use dynamic programming, etc.

+5
source

Source: https://habr.com/ru/post/1347953/


All Articles