[R] combinatorics
Jens Scheidtmann
JensScheidtmann at web.de
Sun Oct 15 13:54:17 CEST 2006
Robin Hankin <r.hankin at noc.soton.ac.uk> writes:
> Hi
>
> How do I generate all ways of ordering sets of indistinguishable items?
>
> suppose I have two A's, two B's and a C.
>
> Then I want
>
> AABBC
> AABCB
> AACBC
> ABABC
> . . .snip...
> BBAAC
> . . .snip...
> CBBAA
>
> [there are 5!/(2!*2!) = 30 arrangements. Note AABBC != BBAAC]
>
> How do I do this?
See Knuth, The Art of Computer Programming Vol 4, Fascicle 3 and 4.
Jens
More information about the R-help
mailing list