(no title)
spapas82 | 2 months ago
Also even in procedural languages there are some problems that are easier to understand and model if you use recursion, for example tree or graph like structures.
spapas82 | 2 months ago
Also even in procedural languages there are some problems that are easier to understand and model if you use recursion, for example tree or graph like structures.
artemonster|2 months ago
bfffbgfdcb|2 months ago
For instance: you have a large graph and you are traversing a particular path through it — say a R/B tree seeking a node. You can write it iteratively or recursively. Neither needs to hold more than 1 node reference at a time, the choice is which you prefer to read and write.
I prefer to write that recursively. Sounds like you may not. Observing “well I can write it iteratively so why do I need TCO” is obvious and uninteresting; that’s the point.