Tuesday, June 21, 2011

Given ‘n’ no of sets and each set is of a variable size. Find out the cross product of these ‘n’ of sets.

For eg. {1,2} , {3,4} , {5,6,7} these are the three sets.The cross product of these sets would be as below.
{1,3,5},{1,3,6},{1,3,7},{1,4,5},{1,4,6},{1,4,7},{2,3,5},{2,3,6},{2,3,7},{2,4,5},
{2,4,6},{2,4,7}.


Data Structure: Binary Tree

Algorithm:


Working Code:






Time Complexity
Space Complexity
Run Here

No comments :