3 ms·
It doesn't have to be recursive. Iteration can also be non-finite-state. In fact, all recursive programs can be transformed to iterative ones.
by cynicalkane 16y ago
It doesn't have to be recursive. Iteration can also be non-finite-state. In fact, all recursive programs can be transformed to iterative ones.
- stcredzero 16y agoYes, thanks for exposing yet another Comp Sci fundamental tidbit. Any word deriving from "recursive" should be a red flag in this case.
- bad_user 16y agoActually recursion in CS is equivalent to using a stack that keeps intermediate values and that grows in relation to the input. If you've got an algorithm that does that, then it cannot be called "iterative". I.e. backtracking is recursive, no matter how you implement it. In school textbooks they do differentiate between "recursive" and "iterative" backtracking, to teach you how to get rid of the call-stack and manage your own. But that's another story.