arXiv · 2501.10102
An Efficient Algorithm for Permutation Iteration Using a Singly Linked List
Abstract
We present a new content-agnostic algorithm for iterating over all permutations of a sequence. The algorithm leverages elementary~$O(1)$ operations on recursive lists. As a result, no new nodes are allocated during the computation. Instead, all elements are rearranged within the original nodes of the singly linked list throughout the process. While permutations are generated in an unusual order, the transitions between consecutive permutations remain smooth. A proof of concept written in the Lisp programming language is referenced and discussed.
Explore related subjects
Keep this discovery
Thomas Baruchel. 2025-01-17. An Efficient Algorithm for Permutation Iteration Using a Singly Linked List. https://arxiv.org/abs/2501.10102
Cite the original work for its findings. Save a collection to share your selection of sources.