creating a copy of BST
void copy(node *& dest, node * root)
dest = NULL;
dest = new node;
dest -> data = root -> data;
copy(dest -> left, root -> left);
copy(dest -> right, root -> right);
Above is my code, I'm running a seg fault when I run it in linux. I looks correct to me and everything is in place? Any ideas?
Aren't you supposed to set the left and right to null somewhere?
Last edited on
Topic archived. No new replies allowed.