Example & Tutorial understanding programming in easy ways.

What is preorder traversal of Binary search tree?

Pre-order traversal:
Pre-order traversal of Binary search tree is follow the pattern "ROOT LEFT RIGHT"
-That means, we can firstly print root then evalute left portion and then right portion.

Following is the function that are used to traverse the Binary search Tree in Pre-order:

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




Read More →
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!