How can I display a binary tree showing its real structure like.
Can any one suggest an algorithm for this purpose
Code:5 3 8 1 4 6 9
How can I display a binary tree showing its real structure like.
Can any one suggest an algorithm for this purpose
Code:5 3 8 1 4 6 9
L GIK wins!!!
Salutes from logicwonder
Enjoy programming
First thing you probably need is something to work out the height of the tree, in order to work out how far to indent the root node.
Then something to take that base level indentation, and with each L or R move, subtract or add an appropriate level of indentation based on the current depth of the traversal.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.