title: Prefix to Infix Conversion Algorithm with figure
body: <p><img src="https://i.stack.imgur.com/wsuHp.png" alt="alt text"></p>
  
  <hr>
  
  <p>After some google search I find it!</p>
  
  <p><strong>Prefix to Infix</strong></p>
  
  <p>This algorithm is a non-tail recursive method.
  The reversed input string is completely pushed into a stack.</p>
  
  <pre><code>prefixToInfix(stack)
     1) IF stack is not empty
       a. Temp --&gt;pop the stack
       b. IF temp is a operator
         i. Write a opening parenthesis to output
         ii. prefixToInfix(stack)
         iii. Write temp to output
         iv. prefixToInfix(stack)
         v. Write a closing parenthesis to output
      c. ELSE IF temp is a space --&gt;prefixToInfix(stack)
      d. ELSE
         i. Write temp to output
         ii. IF stack.top NOT EQUAL to space --&gt;prefixToInfix(stack)
  </code></pre>
  
  <p>when the Stack top is </p>
  
  <blockquote>
    <p>F(ABC)</p>
  </blockquote>
  
  <p>and we enter the algorithm, "A" is written to the output as it was currently the value of </p>
  
  <blockquote>
    <p>temp=A (say)</p>
  </blockquote>
  
  <p>Now how I get '<strong>-</strong>' on the output column as according to the algorithm the next temp value will be "B" which was popped from the stack after the last recursive call.
   How the diagram is showing output "((A-"  ...</p>
  
  <p>Where I am doing the incorrect assumption ?
  Could someone take the trouble in explaining it ?</p>