加载中…
We present a new algorithm for iterating over all permutations of a sequence. The algorithm leverages elementary~ 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. We also present a polynomial-time algorithm for computing an arbitrary permutation given its index.

生成讲解博客的中文版本

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