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?

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / vidhun s

in order:LOR
pre order:OLR
post order:LRO
L=LEFT CHILD
R=RIGHT CHILD
O=ROOT NODE

Is This Answer Correct ?    34 Yes 5 No

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

Answer / kayalvizhi jayavel

Inorder: Left, Node, Right
Preorder: Node, Left, Right
Postorder: Left, Right, Node

Is This Answer Correct ?    30 Yes 7 No

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

Answer / guest

in order:LOR
pre order:OLR

Is This Answer Correct ?    23 Yes 6 No

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

Answer / srinivas.bolusupati

in order:LOR
pre order:OLR
post order:LRO

Is This Answer Correct ?    18 Yes 3 No

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

Answer / sankar

in order:LOR
pre order:OLR
post order:LRO
L=LEFT CHILD
R=RIGHT CHILD
O=ROOT NODE

Is This Answer Correct ?    15 Yes 6 No

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

Answer / shital

typedef struct NODE
{
int data;
struct NODE *left,*right;
}node;

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

}

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

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

}

Is This Answer Correct ?    11 Yes 4 No

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

Answer / 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

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

Answer / sanjeevi

in order:lRr
preorder:Rlr
postorder:lrR
l:left
r:right
R:root

Is This Answer Correct ?    10 Yes 6 No

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

Answer / meenakshi

INORDER:: LNR
PREORDER:: NLR
POSTORDER::LRN
here L stands for the leftnode of the tree R stands for the
right node of the tree and N stands for the root node of
that tree.

Is This Answer Correct ?    10 Yes 6 No

Post New Answer

More Data Structures Interview Questions

How memory is reserved using a declaration statement in data structure?

0 Answers  


Given an unsorted linked list, and without using a temporary buffer, write a method that will delete any duplicates from the linked list?

0 Answers  


Define primary clustering?

0 Answers  


How to print element of Array?

0 Answers  


How to find the missing element in integer array of 1 to 7?

0 Answers  


Does hashset maintain order?

0 Answers  


How to cut or remove an element from the array?

0 Answers  


What is quick sort?

0 Answers  


Write the postfix form of the expression: (a + b) * (c - d)

0 Answers  


How to fill element (initialize at once) in an array?

0 Answers  


Why quicksort is faster?

0 Answers  


Differentiate between file and structure storage structure.

0 Answers  


Categories