Jojo Learns Stacks | SoloLearn: Learn to code for FREE!

+2

Jojo Learns Stacks

Jojo needs to work on her stack data structure for an upcoming interview. She decided to implement it and asked her teacher for a problem on it. She was given an infix mathematical expression by her teacher and was asked to convert it to a postfix expression using stacks. Jojo tried but couldn't do it. She doesn't want to go empty-handed to her teacher. Help her by writing a code to perform the task. -------------------------------------------------------- Input A single string containing a mathematical expression. There is a single whitespace between all operands and operators. Sample Input 5 + 9 * ( 8 + 3 ) -------------------------------------------------------- Output Convert the given expression to postfix and print it, with a single whitespace between all operands and operators. Sample Output 5 9 8 3 + * + Plz Help Me To Understand The Question, It will be better help if anyone explain it to me Tell me how output is 5 9 8 3 + * + 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏

4 Answers

New Answer

+3

Also I found this ,where you can experiment by changing symbols and understand it more clearly ,the result is in step by step too https://www.web4college.com/converters/infix-to-postfix-prefix.php

+3

👍

+2

Symbol:5,+,9,*,(,8,+,3,) Stack:none,+,+,+*,+*(,+*(,+*(+,+*(+,+*(+),+* Expression:5,5,59,59,59,598,598,5983,5983+,5983+*+ Tried to understand it by here , https://www.google.com/search?ie=UTF-8&source=android-browser&q=infix+to+postfix+conversion+step+by+step#

+1

Thanks Abhay , I'm reading the Complete articles, & I hope today, it will be completed If it's not, I'll inform you