Question: 2 - Evaluate the following expressions: 2 3 + 5 4 9 by using stack operations. table [ [ Step , Symbol,Action,Stack ] ,

2- Evaluate the following expressions:
23+549 by using stack operations.
\table[[Step,Symbol,Action,Stack],[,,,],[,,,],[,,,],[,,,],[,,,],[,,,],[,,,],[,,,],[,,,]]
3- The time complexity of converting a prefix notation to infix notation is q,
a)O(n) where n is the length of the equation
b)O(n) where n is number of operands
c)O(1)
d)O(logn) where n is length of the equation
4- In the conversion of an infix expression to a postfix expression using a stack, which of the following represents the correct algorithm?
a) Scan the infix expression from left to right. When an operand is encountered, add it to the output. When an operator is encountered, push it onto the stack.
b) Scan the infix expression from left to right. When an operand is encountered, push it onto the stack. When an operator is encountered, pop operators from the stack until finding one with lower precedence, then push the new operator onto the stack.
c) Scan the infix expression from right to left. When an operand is encountered, add it to the output. When an operator is encountered, push it onto the stack.
d) Scan the infix expression from left to right. When an operand is encountered, push it onto the stack. When an operator is encountered, pop operators from the stack and add them to the output until finding one with lower precedence, then push the new operator onto the stack.
 2- Evaluate the following expressions: 23+549 by using stack operations. \table[[Step,Symbol,Action,Stack],[,,,],[,,,],[,,,],[,,,],[,,,],[,,,],[,,,],[,,,],[,,,]]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!