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 / soma gidugu

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

}

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

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

}

Is This Answer Correct ?    13 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What differences exist between hashmap and hashtable?

991


Why null is allowed in hashmap?

879


Differentiate stack from array?

951


Define circular list?

978


What is difference between array and string?

998


Briefly explain recursive algorithm 50 how do you search for a target key in a linked list?

950


What are data structures in programming?

973


How do signed and unsigned numbers affect memory?

888


Tell us the difference between merge and quick sort. Which one would you prefer and why?

1019


Define quadratic probing?

1024


Can map contain duplicate keys?

850


In what order the elements of a hashset are retrieved?

969


Does treeset allow null?

851


How does shell sort work?

934


What is stack and queue in data structure?

936