The input is a mathematical expression in the form of a String.
The expression may include whole numbers, fractional numbers, parentheses (), spaces, negative signs -, exponents ^, sin(x), cos(x), and tan(x).
Recursion for mathematical expressions
- 14
Locked
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Justin Smith
29 October 2022, 12:40
This can be done, but I feel like this is an exercise in doing something the wrong way. The recursive function would be better off written as returning a double so that you can pass substring components of the expression string and return their outcomes. Doing it as a void method is much more cumbersome, as evidenced by the official solution being over 300 lines long.
0
WIDMO
29 October 2020, 17:32
Can anybody help?
0