for(int i = 0; i < n; i++)
root = insert(root, A[i]);

this code already inserts element by element. I don't honestly understand what you are saying and it is programming, details matter. I...