Skip to content

Instantly share code, notes, and snippets.

@kenthorvath
Last active December 10, 2015 20:48
Show Gist options
  • Save kenthorvath/4490222 to your computer and use it in GitHub Desktop.
Save kenthorvath/4490222 to your computer and use it in GitHub Desktop.
Question for Nathan re: Thief of Baghdad
How many unique permutations are there for a sequence of size n with n_i number of elements of type e_i?
E.g.
The sequence [a a b b] has 4 elements with n_1 = 2; n_2 = 2; and elements e_1 = a and e_2 = b.
The unique permutations of this sequence are:
1: a a b b
2: a b a b
3: a b b a
4: b a b a
5: b b a a
6: b a a b
Update: OK, so it turns out to me (n_1 + n_2)! / (n_1 ! * n_2 !)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment