2 ms·
I use recursion fairly often, and I almost never come back and reimplement it as iterative. Mostly because I know my data structures are bounded, and the thing
by magicalhippo 6y ago
I use recursion fairly often, and I almost never come back and reimplement it as iterative.
Mostly because I know my data structures are bounded, and the thing I'm writing isn't terribly performance sensitive.
The iterative solution is in the language we use a lot more verbose. I'd have to create a separate type to hold any parameters if there's more than one and I'd have to make my own stack of that type. So for most things I just go for plain old recursion.