Can anyone give me some suggestions on how to design an iterative algorithm that gives me the ints from 1 to n in preorder.
I need to insert 1 - n ints in a Binary search tree, keeping it balanced. I have a working recursive algorithm, but it turns out it is not practical to use it in my program.
After sloving the problem recursively (actually quite simple), I find it very hard to think iteratively. I need just a hint really, I'd like to do as much of it no my own as possible. Any hints would be greatly appreciated!
Thank you.
Avendeval
I need to insert 1 - n ints in a Binary search tree, keeping it balanced. I have a working recursive algorithm, but it turns out it is not practical to use it in my program.
After sloving the problem recursively (actually quite simple), I find it very hard to think iteratively. I need just a hint really, I'd like to do as much of it no my own as possible. Any hints would be greatly appreciated!
Thank you.
Avendeval