Recursive function to generate all subsets of a given set