3 ms·
Interestingly, this is basically what CPython does to implement its native permutations function. The C source is, as always, extremely easy to understand: http
by qsort 4y ago
Interestingly, this is basically what CPython does to implement its native permutations function. The C source is, as always, extremely easy to understand: https://github.com/python/cpython/blob/main/Modules/itertoolsmodule.c#L3356 https://github.com/python/cpython/blob/main/Modules/itertool...
- 082349872349872 4y agonice find in Numdam; chouette ! IIRC Iverson presents the isomorphism between factoradic ([R]adix) and indexed ([D]irect) permutation representations in his Turing Award Lecture[0] (p456, via a pair of APL functions): DFR:ω[1],X+ω[1]≤X←DFR 1↓ω:O=pω:ω RFD:ω[1],RFD X-ω[1]≤X←1↓ω:O=pω:ω [0] https://dl.acm.org/ft_gateway.cfm?id=1283935&type=pdf https://dl.acm.org/ft_gateway.cfm?id=1283935&type=pdf