加载中…
We discuss efficient methods for unranking derangements and ménage permutations. That is, we will provide an algorithm to efficiently extract the -th earliest such permutation under the lexicographic ordering. We will show that this problem can be reduced to the problem of computing the number of restricted permutations with a given prefix, and then we will use rook theory to solve this counting problem. This has applications to combinatorics, probability, statistics, and modeling.

生成讲解博客的中文版本

生成AI智能校验的中文版本