cpp implementation of Subsets II