Cycle detection: Difference between revisions
m
→Functional Python
(→Functional Python: Refactoring cycleLength in terms of until, then reimplementing until as iterative) |
|||
Line 1,573:
But recursion scales poorly in Python, and the version above, while good for lists of a few hundred elements, will need refactoring for longer lists and better use of space.
If we start by refactoring the recursion into the form of a higher order (but still recursive)
Recursive ''until'':
|