Problem 6.5 - Subset summing to 0 mod n

#1

The problem calls for any subset however the solution provided in the book only addresses contiguous subsets. The example itself has a non-contiguous subset {3, 4, 9}. What is the best algorithm for subset summing for non-contiguous subsets?

0 Likes

#2

For non-contiguous case, https://en.wikipedia.org/wiki/Subset_sum_problem is the algorithm you are looking for. Of course, it won’t be as fast as the one on the book since it is special case one.

0 Likes

#3

Is this error already in the book’s errata?

0 Likes

#4

This is not an error in fact. The solution in book actually can solve this question but the subset sum algorithm is just a more powerful one with much higher time complexity.

0 Likes

#5

Sorry - I’m confused. The solution in the book explicitly looks for contiguous elements. It does not consider non-contiguous elements as a solution.

0 Likes