使用显式s的置换算法

2024-09-24 22:30:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在读我书中的stack一章,练习中有一个问题:

Describe a nonrecursive algorithm for enumerating all permutations of the
numbers {1, 2, . . . , n} using an explicit stack.

很容易理解和实现递归算法。但我不知道如何用显式堆栈实现它。对此有什么可能的解决办法?如果你认为这些提示足以解决这个问题,请提供它们,以便我再试一次!!在


Tags: ofthe算法anforstackallalgorithm