Suppose we have two array inorder and preorder containing the elements in the said format.
Using these two arrays how can i generate the binary tree??
Any help on the algorithm to be followed will be highly appreciated.
For eg:
inorder is : 2 3 4 5 6 7 8
preorder is : 5 3 2 4 7 6 8
then the Binary tree shld be
________5
________/\
_______3_7
_______/\_/\
______2_4 6_8
How can i form this binary tree??
i know the algorithm by hand but how do i implement it in C??