Is it possible to create a binary non-unique tree using the preorder and postorder sequences ?
If so, how can this be done ? For example how could I make a non-unique tree for:
Preorder:
B C I J K H D E F G
Postorder:
I H K J C G F E D B
How many could there be ?
preorder psedo-code:
and post order is:
so from inorder order we can conclude:
and from postorder order we can conclude:
from here it’s like a Sudoku:
and yes: by using preorder and postorder outputs you can build a tree in only one way.