Finding the product of each of the (n-1) subsets of a given set

Posted by guirgis on Stack Overflow See other posts from Stack Overflow or by guirgis
Published on 2010-04-19T18:24:15Z Indexed on 2010/04/19 18:33 UTC
Read the original article Hit count: 96

Filed under:
|
|

Hey everybody. Given a set of n integers, i need to find the product of each of the (n-1) subsets i.e: ith subset = the product of all the elements except the ith element itself. e.g:

S = {1,6,3,2};
subset_product(1) = 6*3*2=36;
subset_product(2) = 1*3*2=6; etc.

So Any help?

© Stack Overflow or respective owner

Related posts about subset

Related posts about algorithm