answersLogoWhite

0

convert to perfixed to postfixed

User Avatar

Mavis Simonis

Lvl 10
2y ago

Still curious? Ask our experts.

Chat with our AI personalities

CoachCoach
Success isn't just about winning—it's about vision, patience, and playing the long game.
Chat with Coach
ProfessorProfessor
I will give you the most educated answer.
Chat with Professor
RossRoss
Every question is just a happy little opportunity.
Chat with Ross
More answers

To convert a prefix expression to postfix, first reverse the expression and swap the operands' positions. Then scan the expression from left to right, pushing operands onto a stack and applying operators to the top operands of the stack. Finally, the postfix expression will be the final contents of the stack in reverse order.

User Avatar

AnswerBot

12mo ago
User Avatar

Add your answer:

Earn +20 pts
Q: How to convert prefix to postfix?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Linguistics

Prefix to postfix conversion using C programming?

#include<stdio.h> #include<conio.h> #include<string.h> char symbol,s[10]; int F(symbol) { switch(symbol) { case '+': case '-':return 2; case '*': case '/':return 4; case '^': case '$':return 5; case '(':return 0; case '#':return -1; default :return 8; } } int G(symbol) { switch(symbol) { case '+': case '-':return 1; case '*': case '/':return 3; case '^': case '$':return 6; case '(':return 9; case ')':return 0; default: return 7; } } void infix_to_postfix(char infix[],char postfix[]) { int top=-1,j=0,i,symbol; s[++top]='#'; for(i=0;i<strlen(infix);i++) { symbol=infix[i]; while(F(s[top])>G(symbol)) { postfix[j]=s[top--]; j++; } if(F(s[top])!=G(symbol)) s[++top]=symbol; else top--; } while(s[top]!='#') { postfix[j++]=s[top--]; } postfix[j]='\0'; } void main() { char infix[30],postfix[30]; clrscr(); printf("Enter the valid infix expression\n"); scanf("%s",infix); infix_to_postfix(infix, postfix); printf("postfix expression is \n %s", postfix); getch(); }


What is the prefix suffix and root of proselyte?

Actually, proselyte is from Greek root proselytos, which means "convert to Judaism, stranger, one who has come over". The other explanation is pros- (toward) + elyt (convert) + e, however the root 'elyt' still need to be verified.


What the prefix for the word inadaquate?

The prefix for inadequate is in-. The prefix in- means not.


What is the prefix for include?

The prefix for include is in-. This prefix means not.


What is the difference between prefixes and suffixes?

A prefix comes before the word, and suffix comes after it. A prefix is something like "un-" as in undone, unnecessary, or unheeded. A suffix is something like "-less" as in helpless, useless, or timeless.