You are on page 1of 3
LITE ExpRESSION CONVERSION, LNFLx 10 Povrplx : ip use algorithm to write a Program to convert nix be portfix, with the help of stack. + To write the program in CO Programming laps rey © . EQUIPMENIS REQUIRED OPC - ; © Codebloct applecahon AlGoetrum pre Infix expression ‘- coperand ? .. focthix expression: operator? 7 START D Read inkx expression orn usey and! store to input. vlove yverult shalize outpul vtrieg & » in left and repeat step Fr fer BD Son wot Som i ? each element unk! end of input ol et encountered , cole! if fo oubul. » TF operan de os (= encountered, aad” (1 into cedbpedt stac es : i countered | vu operator iw en 6) > Repeatedly pop rom stock and aco) te otbeut i until precedence of operotor in top » of stack ee haher than anrent operator. it) fleck current operator fo stack oe encountered! yo . ca ted ly pop from stock and add & : seal ontl “FCs found) on vtack and cemae Magi, left perenthes iz. ceorent element , remorkiza element on slay int #) ee uput. I for table print —_—_— ey / 1 Scanned with CamScanner ee 3) Repeakeolly pop Son stack oma aah) fo ouput until stack become empty : IO) Print ouput or Snal recut END kK INPUT : CA 1B) * (C-PD 4f-OUTPUT -- AGICD-* 4 ae . S.No Symbol stack Postfix 1 C C fon | 2 A ( fl ite + Ct a 4 B ct AB 5 D) ws ia 6 * x AGbt a | a x¢ | a0 g Cc x ( ABERC 7 io x( Aare 10 D x(- AgICD ) * ABCD » ABTCD-* J Ea ae Scanned with CamScanner i = alii Hence, we have oblained our povtfix expreserorn From on infic with the helo of stock and the aborithe| We comet success full wrote & pryram in C-prosramrss4 ond simelor ly we could oo it to convert pout fx fo nix Scanned with CamScanner

You might also like