I am not getting what i should use as plo(lower value of index for preorder array) when I am constructing the tree for nn.right in construct methid.
Create tree(preoredr & inorder)
your boundary for the left and rt region is not correct.
left = construct(pre, plo + 1, plo + ind - ilo, in, ilo, ind- 1);
right = construct(pre, plo + 1 + ind - ilo, phi, in, ind + 1, ihi);
ind is the index where pre[low]==in[i]
so the no of elements should be equal
so, no of elements of in[] in left: ind-ilo-1( -1 is becoz the ind value is the root value)
no of elements of pre[] in left: plo+ind-ilo
hope this will help u
pls rate my work so that i can improve myself
Why we need to subtract ilo from the boundary indexes
becoz ind-ilo gives the no of elements in left in inorder arraay
similarly, no of elements in left also should be equal in preorder array