Answer :
EVALUATE_PREFIX(STRING)
Step 1: Start by picking up literals from the end
Step 2: If element is an operand push it to Stack
Step 3: If the element is an operator pop two elements from the Stack.
Operate on these elements according to the operator, and push the result back to the Stack
Step 4: Move left and process elements as shown in step 2 and 3 until all are scanned in the expression.
Step 5: The Result is stored at the top of the Stack
Explanation :
+ 10 * 5 4
1. Push 4 to stack
2. Push 5 to stack. Stack contains
|
5 |
|
4 |
3. * is operator. Pop two elements, multiply and push to stack. Stack contains
|
20 |
4. Push 10 to stack. Stack contains
|
10 |
|
20 |
5. + is operator. Pop two elements, add and push to stack. Stack contains
|
30 |
6. Result is 30
QUICK ANSWER PLS What is the result of the following prefix expression? + 10 + 54
C++ code: Problem 3. Convert the following infix expression to a prefix expression by Stack operation. A + B* C + (D^E) * F/G/H + I Evaluate the value of prefix expression when A=5, B=10, C=3, D=12, E=3, F=5, G=8, H=4, I=100
don't answer if not very sure pls
Problem 10. Derive an expression for the contact ratio between an internal gear in contact with a pinion. [5 Points]
What is the value of the following expression? int a1 = 0x42 | 0xb2; Answer the question in Hex using the 0x prefix.
3. (3 pts) What is the result of the following C expression? List your answer as an 16-bit binary number. 25310<210
Convert the following infix expression to A) postfix B) prefix 3 * 4 / ( 5 - 6 * 7 )
could you help me with these
questions pls
A __ is an expression evaluated as either true or false by "if" and "while" clauses. statement block condition decision structure Given two variables, "a" and "b", which expression would you use to test whether or not they are equal? a = b a == b a equals b a and b The answer to this question is the result of the following Boolean expression: 'PROGRAMMING' != 'programming' True False and. or....
10) (4 points) a) Find the value of the postfix expression: 2 3 8+5 - (6 points) b) Find the value of the prefix expression:15 7 23 +21 1
10) (4 points) a) Find the value of the postfix expression: 2 3 8+5 - (6 points) b) Find the value of the prefix expression:15 7 23 +21 1
translate the following c expression into both prefix and postfix notation sqrt(X + sin(A)) * X + A / (X * 5 * + 13) Do not include parenthesis in your answer
Rewrite the following infix expression in prefix and postfix form and draw the syntax tree: (3 − 4) / 5 + 6 * 7
Translate the following expression into postfix and prefix notation: [−b + sqrt(b × b − 4 × a × c)]/(2 × a) Do you need a special symbol for unary negation?