The first node in preorder traversal is root . So take the node at preIndex from preorder and make it root , and increment preIndex
struct node * root = newNode ( pre [ * preIndex ] ) ; ++ * preIndex ;