Solution Review: Infix-to-Prefix Conversion

Let’s take a detailed look at the previous challenge’s solution.

Solution

  1. We reverse the given infix expression.
  2. We replace ( with ), and ) with ( in the reversed expression.
  3. Now, we apply infix to postfix subroutines that we’ve already discussed.
  4. We reverse the generated postfix expression. This will give the required prefix expression.

Get hands-on with 1400+ tech skills courses.