开发者

test whether k elements of a set add up to a certain number

Is there a way to determine if k elements of a set add up to a certain number in po开发者_Go百科lynomial time?


How big is the number?

This is a variation on the subset sum problem, which is well-known and NP-complete. However dynamic programming techniques will make it polynomial if the set of possible values that the subsets can take grows polynomially. Which with general integers, isn't true. But with numbers picked from a restricted range happens surprisingly often.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜