Sunday, August 19, 2007

never resist the temptation...

I am tempted to post this problem.

Let S={ 1,2,...,n}
A and B are non empty subsets of S.
C is a subset of S with elements of form a+b where a belongs to A and b belongs to B.

Give an algorithm to generate all possible set D={ A,B}