Input: <textfile containing a list just like the one presented below – see sample input file>
(A,B,E) (this means A is the root, B is the left subtree, and E is the right subtree)
(B,C,null) (this means B is the root, C is the left subtree, and there is no right subtree)
(C,null,D)
(E,F,H)
(F,null,G)
(H,I,J)
Output:
Node L-Subtree R-Subtree
A B E
B C null
C null D
E F H
F null G
H I J
Root of the Tree: A
Preorder Traversal: A B C D E F G H I J
In order Traversal: C D B A F G E I H J
Post order Traversal: D C B G F I J H E A