Is this variant of the subset sum problem easier to solve?

后端 未结 8 847
旧巷少年郎
旧巷少年郎 2020-12-08 23:18

I have a problem related to the subset sum problem and am wondering if the differences make it easier, i.e. solvable in a reasonable amount of time.

Given a value V,

8条回答
  •  感动是毒
    2020-12-09 00:09

    This sounds like an n choose k category of problem. Generating k-subsets of n is covered in Skiena's Algorithm Design Manual, and the book suggests enumerating relevant subsets in lexicographic order (recursively, for example). Then do your sum and comparison on each subset.

    If you have a sorted set, you could presumably prune impossible solutions from the solution space.

提交回复
热议问题