The subset whose sum is the smallest sum over a certain threshold

Given a set of positive integers, I want a subset of those integers whose sum is the smallest sum that exceeds the threshold.

+3
source share
3 answers

Your problem is variation. The task is a subset of the sums and is NP-complete.

To understand why, suppose you have an algorithm that can solve your problem, and it gives an answer with the sum s. Then you proved that there is no subset of integers equal to s-1, that is, you have a solution to the problem of the sum of the subset.

, . , , , , . , .

+4

! N C, O (NC).

Pisinger , , . , , Pisinger, NOT .

.

-: http://www.diku.dk/~pisinger/95-6.ps

: Pisinger

0

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


All Articles