一种生成多种组合结构的通用算法
A Versatile Algorithm to Generate Various Combinatorial Structures
摘要:
生成各种组合结构的算法在计算机科学中具有巨大的重要性。在本文中,我们首先回顾了由Rohl提出的算法,该算法生成可能包含重复的元素列表的所有唯一排列,一次取部分或全部元素,以任何强加的顺序。该算法使用一个辅助数组来维护输入列表中每个唯一元素的出现次数。我们提供了一个算法的正确性证明。然后,我们展示了如何有效地生成其他组合结构,如组合,子集,n-Parenthesizations,排列和整数分区和组合,对同一算法进行微小的更改。
英文摘要:
Algorithms to generate various combinatorial structures find tremendous importance in computer science. In this paper, we begin by reviewing an algorithm proposed by Rohl that generates all unique permutations of a list of elements which possibly contains repetitions, taking some or all of the elements at a time, in any imposed order. The algorithm uses an auxiliary array that maintains the number of occurrences of each unique element in the input list. We provide a proof of correctness of the algorithm. We then show how one can efficiently generate other combinatorial structures like combinations, subsets, n-Parenthesizations, derangements and integer partitions & compositions with minor changes to the same algorithm.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。