In binary tree build tree form

In the function what the point of i and why are we incrementing it later on.

i is used to keep track of preorder array

and it is incremented later as we are using i for finding pre[i] in inorder array