Write the postfix form of the expression: (A + B) * (C – D)

AB+CD-*

To convert the infix expression (A + B) * (C - D) into postfix form, you can use the shunting-yard algorithm or simply understand the rules of postfix notation, which involve placing operators after their operands.

Here’s how you can convert (A + B) * (C - D) into postfix notation:

  1. Start with an empty stack to hold operators.
  2. Begin scanning the expression from left to right.
  3. When you encounter an operand (in this case, letters A, B, C, D), add it to the output string.
  4. When you encounter an operator, check its precedence against the operators already on the stack:
    • If the stack is empty or the operator on the top of the stack has lower precedence than the current operator, push the current operator onto the stack.
    • If the current operator has higher precedence than the operator on the top of the stack, or they have equal precedence and the current operator is left-associative, pop operators from the stack and append them to the output string until an operator with lower precedence is encountered or the stack is empty. Then push the current operator onto the stack.
  5. If you encounter a left parenthesis, push it onto the stack.
  6. If you encounter a right parenthesis, pop operators from the stack and append them to the output string until a left parenthesis is encountered. Discard the left parenthesis.
  7. Continue this process until the entire expression is scanned.

Following these rules, the postfix form of the expression (A + B) * (C - D) would be:

AB+CD-*

So, the correct answer is AB+CD-*.