Open Chadtech opened 7 years ago
Maybe it should be lazy?
@zwilias made this cool Ellie app demonstrating an implementation of the next permutation algorithm. Could be useful to this project : https://ellie-app.com/3vnrtbJffbYa1/0
We might want to consider the implementation of subsequences
as well, which outputs a list of 2n lists for an input list of length n.
In the slack channel, Numiastowski discovered that
permutations
causes a memory problem. A list of 9 elements might have as many as 9! permutations, and therefore, 9! stack calls.I believe this can be solved by implementing something like this: https://www.nayuki.io/page/next-lexicographical-permutation-algorithm, or
any non-recursive permutation function.But before settling on that, we should consider use cases of the
permutation
function. Has anyone used it? How did you use it? What problem did it solve for you?