Construct tree from InOrder and
is DLR and InOrder is LDR
means, first element of PreOrder is the root of the tree.
in InOrder, root is found after all its left subtree has been
implies that left part from start to root in InOrder is the left
PreOrder, take same number of characters after root.
two smaller subsequences from pre-order and in-order can be used to
form a left subtree and similarly the right subtree.
sequence: D B E A F C
sequence: A B D E C F
root is A
left subtree has 3 characters - DBE
similar number of characters from InOrder - BDE
subtree for these two and make it left child.
part is FC from InOrder and CF from PreOrder.
the recursion to form right subtree.