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

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 19:23 UTC
Read the original article Hit count: 152

Filed under:
|
|

Hey everybody. Given an array 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,0,3,2};
subset_product(1) = 0*3*2=0;
subset_product(2) = 1*3*2=6; etc.

So Any help?

© Stack Overflow or respective owner

Related posts about subset

Related posts about algorithm