开发者

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

开发者 https://www.devze.com 2023-03-06 03:48 出处:网络
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?

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

精彩评论

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