Can anybody provide me an optimized approach on how to find the sum of all subsets of a set. suppose my set is {a, b, c}. So subsets are — {a}, {b}, {c}, {a,b}, {a,c}, {b,c}, {a,b,c}. I want to find a + b + c + (a + b) + (a + c) + (b + c) + (a + b + c). Thanks in advance.
Let there be n elements. For each of the n elements in the set, there are 2n - 1 subsets that include that element. Therefore if you take that is your answer.