DEV Community

Discussion on: Do you even recurse?... And if you do, do you do it safely?

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

I continue to use recursion where it's difficult to implement an algorithm without (lots of tree structures come to mind), or where unrolling the recursion makes it harder to understand. So long as it isn't too deep it's fine.

Collapse
 
bgadrian profile image
Adrian B.G.

Ah yes, if the amount of data is pretty deterministic and small and the iterative version is too cumberstone I do the same.