Abstract
In this paper, we propose linear-time algorithms for ranking and unranking derangements. Myrvold and Ruskey proposed the linear-time ranking and unranking of permutations that use a novel approach to convert a random generation algorithm into an unranking algorithm. Our algorithms achieve the exact linear-time ranking and unranking of derangements by applying a method specialized for derangements. We use a computational model that enables arithmetic operations and random access for O(logn!)=O(nlogn) bits to be executed in constant time.
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have