iomplement backtracking algorithm, used for finding subsets, and generating permutations