4 ms·
I kind of agree with your teacher. Some things are easier with recursion, like traversing a tree. But outside of those I'd avoid using recursion. In other word
by cypress66 4y ago
I kind of agree with your teacher.
Some things are easier with recursion, like traversing a tree. But outside of those I'd avoid using recursion. In other words, only use recursion if you have a good reason.
Your typical code base will use very little recursion, if any.
It is generally less readable, and relatively easy to blow up your stack.