unranking
Unranking is the process of constructing a combinatorial object from its rank within a fixed enumeration of objects, and is the inverse operation of ranking. It is used to generate objects in a specified order, to sample objects randomly by selecting a rank and unranking it, and to enumerate large or complex search spaces without duplications.
In the case of permutations of n elements, ranks range from 0 to n! − 1. Unranking decodes
For combinations, unranking maps a rank r in 0 ≤ r < C(n, k) to the r-th k-subset in
Unranking also applies to other object classes such as trees and graphs, frequently requiring recursive decompositions
Applications include systematic generation of all objects in a given class, random sampling by selecting a