...

/

Solution Review: Infix-to-Prefix Conversion

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.
Access this course and 1400+ top-rated courses and projects.