Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Assume that the operators +, , X are left ass... Start Learning for Free
Assume that the operators +, , X  are left associative and  is right associative. The order of precedence (from highest to lowest) is , X, +, -. The postfix expression corresponding to the infix expression  is
  • a)
  • b)
  • c)
  • d)
Correct answer is option 'A'. Can you explain this answer?
Verified Answer
Assume that the operators +, , X are left associative and is right ass...
Here is the procedure first :

Scan Infix Expression from left to right whenever you see operand just print it.

But In case of operator

if(stack is empty) then push it.

if(precedence(tos) < precedence(current operator) ) push it.

else if (precedence(tos) > precedence(current operator) ) pop and print.


else if (precedence(tos) == precedence(current operator) ) then check for associativity.In case Operators are Left to right

then pop and print it otherwise push the current operator (Right to Left Associativity)

And once you have scanned infix expression completely. Make sure pop all the element and print it in same order.

Here the infix expression is a+b�c−d^e^f

a : print it

+ : push into the Operator Stack

b : print it

* : its having higher precedence than + then push into Operator Stack

c : print it

'-' : '-' is having less precedence than '*' so pop from operator stack and print '*'.after this stack will be having '+' on

top.which is having same precedence as '-' but both are left to right associative then just pop + and print it.Now stack is

empty. Push '-' to it.

d : print it

'^' : top of the stack is having '-' which has lower precedence than '^' so simply push '^' into stack

e : print it.

'^' : Now top of the stack is '^' and has same precedence so associativity will come to picture. Since '^' is right associative

as given in question. So '^' will be pushed.

f : print it.

Now we have scanned entire infix expression.Now pop the stack untill it becomes empty.This way you will get

abc*+def^^-

Hence option (A) is correct

For studying everything about algorithms click on the link given below:
View all questions of this test
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

Top Courses for Computer Science Engineering (CSE)

Assume that the operators +, , X are left associative and is right associative. The order of precedence (from highest to lowest)is , X, +, -. The postfix expression corresponding to the infix expression isa)b)c)d)Correct answer is option 'A'. Can you explain this answer?
Question Description
Assume that the operators +, , X are left associative and is right associative. The order of precedence (from highest to lowest)is , X, +, -. The postfix expression corresponding to the infix expression isa)b)c)d)Correct answer is option 'A'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about Assume that the operators +, , X are left associative and is right associative. The order of precedence (from highest to lowest)is , X, +, -. The postfix expression corresponding to the infix expression isa)b)c)d)Correct answer is option 'A'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Assume that the operators +, , X are left associative and is right associative. The order of precedence (from highest to lowest)is , X, +, -. The postfix expression corresponding to the infix expression isa)b)c)d)Correct answer is option 'A'. Can you explain this answer?.
Solutions for Assume that the operators +, , X are left associative and is right associative. The order of precedence (from highest to lowest)is , X, +, -. The postfix expression corresponding to the infix expression isa)b)c)d)Correct answer is option 'A'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of Assume that the operators +, , X are left associative and is right associative. The order of precedence (from highest to lowest)is , X, +, -. The postfix expression corresponding to the infix expression isa)b)c)d)Correct answer is option 'A'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Assume that the operators +, , X are left associative and is right associative. The order of precedence (from highest to lowest)is , X, +, -. The postfix expression corresponding to the infix expression isa)b)c)d)Correct answer is option 'A'. Can you explain this answer?, a detailed solution for Assume that the operators +, , X are left associative and is right associative. The order of precedence (from highest to lowest)is , X, +, -. The postfix expression corresponding to the infix expression isa)b)c)d)Correct answer is option 'A'. Can you explain this answer? has been provided alongside types of Assume that the operators +, , X are left associative and is right associative. The order of precedence (from highest to lowest)is , X, +, -. The postfix expression corresponding to the infix expression isa)b)c)d)Correct answer is option 'A'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Assume that the operators +, , X are left associative and is right associative. The order of precedence (from highest to lowest)is , X, +, -. The postfix expression corresponding to the infix expression isa)b)c)d)Correct answer is option 'A'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev