what is basic logic used while converting from infix to postfix using stack .i mean i have seen plenty of books but they just dont tell why are we doing those steps please help. this problem is really killing me

solving it in parts as we do by using brackets…

I believe you are referring to what is known as the Shunting-Yard Algorithm.

Here is a ppt with a small animated example.

I did not get your question “why are we doing those steps”.

As a vague and general answer, we are doing these steps to convert an infix expression into its equivalent postfix expression. I know this answer is more than useless to you. But, to give a more precise answer, can you be more specific on the question? Like, what operations/steps are you exactly referring?

Keep in mind that the final postfix expression we get is evaluation ready, by which I mean, that all operator precedences are resolved and we just need to evaluate the expression from left to right, without any fear of operator precedences.

Look at each operation keeping the above point in mind, and reanalyze the algorithm.

If you are still unable to get an answer to “why”, then reply with the specific steps/operations you need explanation to.

Best!