in reply to finding values in an array that add up to a specific number

This is related to the NP-complete subset sum problem...

See: Subset Sum Problem

This is most likely only relevant if your set is very large. There is an algorithm to solve it in polynomial time that trades off non-polynomial high memory usage for fast processing time.

See: Polynomial Time Dynamic Programming Solution

-Andrew.


Andrew Tomazos  |  andrew@tomazos.com  |  www.tomazos.com
  • Comment on Re: finding values in an array that add up to a specific number