Блог пользователя avik26091998

Автор avik26091998, история, 6 лет назад, По-английски

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.

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
6 лет назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

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.