in reply to Binary tree without recurssion

I'm guessing your cited previous query was How do I create a binary tree ?. Please link to previous questions ([id://1149515], Markup in the Monastery) so that those who might want to help you don't have to.

Why do you want to avoid recursion? Performance reasons? Spec from instructor? Usually when people ask this sort of thing, it's an XY Problem.

As Anonymous Monk cheerfully points out, recursion is just iteration. This is usually most easily done with Loop Control. If your tree isn't doubly linked, you'll probably also want to maintain a stack for traversing upwards. Recursion is usually taught first because it is more intuitive. If you share your implemented binary tree (wrapped in code tags), I'd be happy to show how to adapt your algorithm.

Happy holidays.


#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.