[comp.edu] Generating combinations

solid@aucs.uucp (Tomasz Muldner) (06/08/90)

I need to write a program to generate all sequences of k letters, each
letter has to occur exactly n times, for example for k=2, n=2 we have

	AABB
	ABAB
	ABBA
	BAAB
	BABA
	BBAA

I'm interested in a case where k=7 and n=5, so the program should not
consider all (n*k)! permutations. I would be happy to get any suggestions
as to what algorithm should be used.


-- 
Dr. Tomasz Muldner, Professor, Jodrey School of Computer Science
Acadia University, Wolfville, NS, Canada B0P1X0
UUCP:      {seismo|watmath|utai|garfield}!dalcs!aucs!solid
BITNET:    solid@Acadia