0

Given:

  • Set of size n
  • Select elements (unordered, no duplicates) from that set
  • Select k elements, for which min <= k < max

Question: How many k-combinations are there?

If k were a fixed number, wikipedia has the answer: n! / (k! (n-k)!) Unfortunately, it's not.

For example:

  • Given the set [A, B, C, D, E], select at least 2 and at most 3 elements.
  • So n=5, min=2, max=4, 2 <= k < 4.
  • Number of combinations: 6!/2!4! + 6!/3!3! = 720/48 + 720/36 = 35

So 35 combinations. What's the general formula given n, min, max?

0 Answers0