ADSL-2 (1) Post To in
ADSL-2 (1) Post To in
#include <cctype>
class node
public:
char data;
node (char x)
data=x;
left=right=NULL;
};
class stack
public:
int top;
node *st[50];
stack()
top=-1;
st[++top]=temp;
node *pop()
return st[top--];
}
};
node *create()
char postfix[20];
int i=0;
stack s;
node *root;
cin>>postfix;
while(postfix [i]!='\0')
if (isalnum(postfix[i]))
s.push(root);
else
root->right=s.pop();
root->left = s.pop();
s.push(root);
i++;
root= s.pop();
return root;
if (temp!=NULL)
{
in(temp->left);
cout<<"\t"<<temp->data;
in (temp->right);
int main()
node *temp=create();
in (temp);