Removing recursion via explicit callstack simulation

This is about a technique I stumbled into while converting some tough recursive code into stack-safe form. I hope it's helpful to others. Please let me know if anyone has any questions, or if you have any answers to the "open questions" section at the bottom.

submitted by /u/josephjnk
[link] [comments]