Amidakuji: Gray Code Algorithms for Listing Ladder Lotteries

Di Salvo, Patrick
Journal Title
Journal ISSN
Volume Title
University of Guelph

We provide a Gray code for listing ladder lotteries in which successive ladders differ by the addition/removal of a single bar or the relocation of a bar. Ladder lotteries are an abstract mathematical object which correspond to permutations. They are a network of vertical lines and horizontal bars, which induce transpositions on elements in a specific permutation when the lines cross. Ladder lotteries are of interest to the field of theoretical computer science because of their relationship with other mathematical objects such as primitive sorting networks. To list ladder lotteries, we define a function that calculates the location for any bar in the data structure in O(1) time. We provide an O(n2) amortized algorithm for creating a specific ladder corresponding to a specific permutation. We provide an O(1) amortized algorithm for listing n! canonical ladders by adding or removing a bar. Finally, we provide a Gray code for listing n! ladders ordered by the number of bars.

algorithms, discrete math, Theory of Computation, gray codes, enumeration