So, I have a tree data structure which should work fine but now I want to print the results. My problem is if the parent node has two children (right and left) which aren't null; what path should it take? If it takes lets say right then all of the left ones after that node get left out?
I want the tree to be in the correct order
Example of what it'll do if I do not order it correctly:
-----------------------------root---------------------------------------
-------------------value---------------skips this value-----------------
-------------value-------skips this value-- skips this value -- skips this value
----------value -------skips this value----- skips this value ---- skips this value
What I'd like it to do:
-----------------------------------root----------------------------------
---------------------------value-----------value-------------------------
----------------------value----value-----value---value-------------------
--------------------value--value--value-value-value-value-value
and so on(I'd continue on but it gets cluttered)
I'll need to place my nodes into a stack and order them in advance. Suggestions?