Write a C program to create a copy of a tree

October 28, 2007 · Filed Under Placement Questions, Tree 



Don't want to miss a single bit? Subscribe By Email for Daily Jobs

Enter your email address :

All the latest from JobsAdda on Jobsadda.com delivered to your mailbox everyday.

Here is a C program which does that…

mynode *copy(mynode *root)
{
mynode *temp;

if(root==NULL)return(NULL);

temp = (mynode *) malloc(sizeof(mynode));
temp->value = root->value;

temp->left = copy(root->left);
temp->right = copy(root->right);

return(temp);
}

Related Articles


Get Latest JobsAdda.com Jobs, news & updates  via Email