I'm new to Stackexchange and maybe I do not have the correct mathematical terms for the question I'm about to ask.
I'm given a multiset of given size $N$ which consists of zeros and ones.
Example:
Multiset size $5$ with number of ones: $2$, number of zeros: $3$
How many distinct arrangements (sequences) of all these items are possible?
First arrangement is: $0,0,0,1,1$
Listing all arrangements in ascending order:
1: $0,0,0,1,1$
2: $0,0,1,0,1$
3: $0,0,1,1,0$
4: $0,1,0,0,1$
5: $0,1,0,1,0$
6: $0,1,1,0,0$
7: $1,0,0,0,1$
8: $1,0,0,1,0$
9: $1,0,1,0,0$
10: $1,1,0,0,0$
Because in a real task the set size could be much larger than this example, is it possible without iterating through all arrangements:
To find the $n^{\text{th}}$ arrangment in the lexicographically ordered list (example $7^{\text{th}}$ permutation = $1,0,0,0,1$) ?
To calculate the index if I'm given the arrangement (example $0,1,0,1,0 = 5$) ?
I'm looking for an algorithm suitable for implementation in some programming language.