Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How will inorder, preorder and postorder traversals print
the elements of a tree?

Answer Posted / meganathan

void inorder(node * tree)
{
if(tree != NULL)
{
inorder(tree->leftchild);
printf("%d ",tree->data);
inorder(tree->rightchild);
}
else
return;

}

void postorder(node * tree)
{
if(tree != NULL)
{
postorder(tree->leftchild);
postorder(tree->rightchild);
printf("%d ",tree->data);
}
else
return;
}

void preorder(node * tree)
{
if(tree != NULL)
{
printf("%d ",tree->data);
preorder(tree->leftchild);
preorder(tree->rightchild);
}
else
return;

}

Is This Answer Correct ?    54 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the Insertion Sort Code?.

978


Why do we need linked list?

780


What is circular queue in data structure?

844


What is bitonic search?

874


What are the disadvantages of linear list?

863


Is priority queue sorted?

909


How do signed and unsigned numbers affect memory?

837


Is arraylist fail fast?

879


What is ds tree?

850


What is vector and types of vector?

943


Explain the uses of b+ tree.

864


Should I use hashmap or hashtable?

842


Can we insert null in hashset?

992


How will you check the validity of an expression containing nested parentheses?

878


Can treemap have duplicate values?

822