3 ms·
Typically you don't use dynamic allocation, making trees much more tedious to implement. The usual data structure is a stack allocated constant size array. But
by adrianN 11y ago
Typically you don't use dynamic allocation, making trees much more tedious to implement. The usual data structure is a stack allocated constant size array.
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.