0% found this document useful (0 votes)
10 views3 pages

ADSL-2 (1) Post To in

A2

Uploaded by

virenlahane7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

ADSL-2 (1) Post To in

A2

Uploaded by

virenlahane7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

#include <iostream>

using namespace std;

#include <cctype>

class node

public:

char data;

node *left, *right;

node (char x)

data=x;

left=right=NULL;

};

class stack

public:

int top;

node *st[50];

stack()

top=-1;

void push (node *temp)

st[++top]=temp;

node *pop()

return st[top--];

}
};

node *create()

char postfix[20];

int i=0;

stack s;

node *root;

cout<<"Enter postfix expression ";

cin>>postfix;

while(postfix [i]!='\0')

root=new node (postfix[i]);

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;

void in (node *temp)

if (temp!=NULL)

{
in(temp->left);

cout<<"\t"<<temp->data;

in (temp->right);

int main()

node *temp=create();

in (temp);

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy