2

I am looking for the canonical implementation of the "k-combinations with repetition" algorithm.

Simple Example:

Input: "ABC" (choose 2)

['AA', 'AB', 'AC', 'BB', 'BC', 'CC']

I have a recursive implementation, I'm looking for the performance optimized state of the art version. Usually people mention Knuth for this, but I haven't seen a specific reference to Vol 4a or otherwise for this particular one. Not to say it isn't there, just haven't found any references to it.

Where might I look further into this?

Solaxun
  • 121
  • 3

0 Answers0