How to Generate all k-elements subsets from an N-elements set recursively in Java
问题 So I am stuck with this problem of trying to find all k-elements subsets from a given N-elements set. I know what the total number of k-subsets is using the formula C(n,k)=C(n-1, k-1)+C(n-1, k) and I also have an idea how to do it in a iterative manner, but I get stuck when I try to think of a recursive solution. Can anyone give me a hint? Thanks! 回答1: For each element of the set, take that element, then add in turn to that all (k-1) subsets of the remaining N-1 element set. "It was a dark