John Martin

John Martin

  • NA
  • 42
  • 5k

Help with a binary search tree with an expected output.

Aug 28 2018 7:02 PM
I am trying to print in order, print in pre order and print in post order. Any help with this will be appreciated. I have included a zip file of the code that I have so far. Thanks in advance for your help. The expected output is:
 
Building the tree with root value 50
************************************
Insert 26 to left of node 50
Insert 15 to left of node 26
Insert 32 to right of node 26
Insert 78 to right of node 50
 
Traversing the tree in order
************************************
Traversed 15
Traversed 26
Traversed 32
Traversed 50
Traversed 78
 
Traversing the tree in preorder
************************************
Traversed 50 
Traversed 26
Traversed 15
Traversed 32
Traversed 78
 
Traversing the tree in postorder
*********************************
Traversed 15
Traversed 32
Traversed 26
Traversed 78
Traversed 50 

Attachment: BinaryTree.zip

Answers (3)