Given a set of n elements, find sum of product of subsets of size at most k ( k is another integer).
The Range of n is in the 1000s so a I need something more faster than exponential time complexity.
I feel this problem might be solved using Polynomial FFT, but I'm not sure. Also, check this out https://math.stackexchange.com/questions/786183/sum-of-multiplication-of-all-combination-of-m-element-from-an-array-of-n-element/788655#788655
For example :
S : {1, 2, 3, 4, 5}
k = 2
Then, the answer will be
1 + 2 + 3 + 4 + 5 + 1*2 + 1*3 + 1*4 + 1*5 + 2*3 + 2*4 + 2*5 + 3*4 + 3*5
Pseudocode or just some pointers as to how to come closer to the solution are higly appreciated.