3 ms·
There are problems that are inherently tree-structured and where anything other than recursion feels wrong. “Process all the files in this directory structure,
by sokoloff 6y ago
There are problems that are inherently tree-structured and where anything other than recursion feels wrong.
“Process all the files in this directory structure, counting them and summing their size.” Sure, you can solve that without recursing, but I’d trust a recursive algorithm to have fewer hidden bugs.
- junke 6y agoAt least the recursive version stops by blowing the control stack when there is a loop in the file system.