Home All Groups Group Topic Archive Search About

writing function for permutation

Author
2 Feb 2006 6:04 AM
dave
Hi There
Can anyone help to write permutation function for following formula..
nPr = n!/(n-r)!
where n is length of given string and r is lengh of subset..
for example..if given string is "abcd" and r = 2 then out put shuld be
ab
ac
ad
ba
bc
bd..and so on...

and if r = 3 then output shuld be
abc
abd
acb
acd and so on...

Any help would be highly appreciated..
thnx
dave

Author
2 Feb 2006 9:12 AM
CMM
Do a search on Google for:  vb permutations
Lots of interesting algorithms out there.