In the postfix expression evaluation example, the two most re- cent operands are popped when an operator is encountered so that the sub-expression can be evaluated. The first operand popped is treated as the second operand in the sub-expression, and the second operand popped is the first. Give and explain an example that demonstrates the importance of this aspect of the solution.
What will be an ideal response?
For operations such as addition and multiplication, the order of operands does not matter, but for subtraction and division, for instance they do. So the postfix expression
17 4 -
means to subtract 4 from 17 (and not the other way around). When these operands are pushed onto the stack, 17 goes on first, then 4 on top. So when they are popped to be evaluated, the first value popped must be treated as the second operand.
You might also like to view...
What free and open source software office suite can usually be found bundled with most Linux distributions?
A. Microsoft Office B. WordPerfect C. LibreOffice D. Adobe Suite
________ language consists of a series of 0s and 1s
Fill in the blank(s) with correct word
Which type of PL/SQL statement would you use to increase the price values by 10 percent for items with more than 2,000 in stock and by 20 percent for items with fewer than 500 in stock?
A. A WHILE loop B. A simple UPDATE statement C. A simple INSERT loop D. An IF...THEN...ELSE statement
You find the jQuery UI category on the Dreamweaver ____.
A. Application bar B. Insert panel C. Property inspector D. status bar