How will inorder, preorder and postorder traversals print
the elements of a tree?
Answers were Sorted based on User's Feedback
Answer / narendra sharma
struct tree
{
int data;
struct NODE, *left, *right;
}
typedef struct node;
void inorder(node * tree)
{
if(root!=null)
inorder(tree->leftchild);
printf("%d",tree->data);
inorder(tree->rightchild);
}
void preorder(node * tree)
{
if(root!=null)
printf("%d",tree->data);
preorder(((tree->leftchild);
preorder(((tree->rightchild);
}
void postorder(node * tree)
{
if(root!=null)
postorder(tree->leftchild);
postorder(tree->rightchild);
printf("%d",tree->data);
}
| Is This Answer Correct ? | 1 Yes | 2 No |
What do you mean by union-by-weight?
Is selection sort greedy?
Mention the data structures which are used in graph implementation.
How do hash tables work?
Write a Program for Linked list manipulation.
Is heap sort adaptive?
Which interfaces are implemented by enumset?
applications of stacks and their uses?
How to sort 1 million floating point numbers?
Describe binary tree and its property.
Will hashmap allow null keys?
Define threaded binary tree. Explain its common uses