When you can't use recursion, what data structures/algorithms do you use in place of the common data structures that often use recursion? I'm thinking of stuff like trees and quicksort. Do they even need these things?
There's probably no change in the algorithms. They just use non-recursive versions.
They probably don't use trees and quicksort at all.
> What's the gain?
You can prove that you won't have a stack overflow. You can calculate the maximum depth of the stack at compile time, not runtime.If you can calculate the size of the stack at compile time, you don't need to manually manage it.
But if you really have to use recursion, you can always simulate it with a loop and an explicit stack. This way it's also easy to bound the stack size.