for (int i = 1; i <= N - 1; i++) { insert(root, P[i]);}void insert(Vertex V, int X) { if (X < the value stored in V) { if (V has a left child) { insert(V's left child, X); } else { create V's left child and store X there; } } else { if (V has a right child) { insert(V's right child, X); } else { create V's right child and store X there; } }}