Solution Review: Infix-to-Prefix Conversion
Let’s take a detailed look at the previous challenge’s solution.
We'll cover the following
Solution
- We reverse the given infix expression.
- We replace
(
with)
, and)
with(
in the reversed expression. - Now, we apply infix to postfix subroutines that we’ve already discussed.
- We reverse the generated postfix expression. This will give the required prefix expression.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.