0
939views
Write a menu-driven C Program to construct an expression tree in preorder and inorder format using postorder expression.

Test program for the following Post-order Expressions:

1] AB+

2] AB+CD-*

3] ABC+*C*

4] AB+C*D-

1 Answer
0
4views

Menu-driven C Program to construct Inorder, Preorder expression from Postorder Expression

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<ctype.h>
#include<string.h>
typedef struct treenode
{
char data;
struct treenode *left,*right;
}treenode;
typedef struct stack
{
treenode *data[20];
int top;
}stack;
void init(stack *s)
{
s->top=-1;
}
treenode *pop(stack *s)
{
treenode *p;
p=s->data[s->top];
s->top=s->top-1;
return(p); …

Create a free account to keep reading this post.

and 4 others joined a min ago.

Please log in to add an answer.