Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

void infixToPostfix ( char * infix, char * postfix ) { int i , j; int top = - 1 ; char stack [ Max

void infixToPostfix(char* infix, char* postfix){ int i, j; int top =-1; char stack[Max_Length]; for (i =0, j =0; infix[i]!='\0'; i++){ if (isOperand(infix[i])){ postfix[j++]= infix[i]; } else if (infix[i]=='('){ stack[++top]= infix[i]; } else if (infix[i]==')'){ while (top !=-1 && stack[top]!='('){ postfix[j++]= stack[top--]; } top--; // Pop '(' from the stack } else { while (top !=-1 && precedence(infix[i])<= precedence(stack[top])){ postfix[j++]= stack[top--]; } stack[++top]= infix[i]; }} while (top !=-1){ postfix[j++]= stack[top--]; } postfix[j]='\0';} Is this code correct

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

How can most consumer complaints be solved?

Answered: 1 week ago

Question

2. What efforts are countries making to reverse the brain drain?

Answered: 1 week ago