Question: Write a function called EvalPrefix that accepts a validated prefix expression, composed only of operators and single digit integer values, and recursively evaluates the expression,
Write a function called EvalPrefix that accepts a validated prefix expression, composed only of operators and single digit integer values, and recursively evaluates the expression, returning an integer result. Your solution should not use a stack. The class, in which this is to be included, also contains the following private functions. You may use them if you wish. private int Oper (char Symb, int Op1, int Op2 ); //Oper returns the result of applying the operator in Symb to the //operands in Op1 and Op2 private char GetSymb ( string data); //Extracts an operator symbol from data private int GetValue ( string data); //Extracts an operand value from data.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
