[algorithm] conversion from infix to prefix

In Prefix expression operators comes first then operands : +ab[ oprator ab ]

Infix : (a–b)/c*(d + e – f / g)


Step 1: (a - b) = (- ab) [ '(' has highest priority ]

step 2: (d + e - f / g) = (d + e - / fg) [ '/' has highest priority ]

                       = (+ de - / fg )

          ['+','-' has same priority but left to right associativity]

                       = (- + de / fg)

Step 3: (-ab )/ c * (- + de / fg) = / - abc * (- + de / fg)

                                 = * / - abc - + de / fg 

Prefix : * / - abc - + de / fg