raj457036 / Simple-Tools

This repo contains simple tools like clock, Calculator, etc.
https://raj457036.github.io/Simple-Tools/
34 stars 11 forks source link

Infix to Postfix convertor gives wrong output #9

Closed mudit-51 closed 1 year ago

mudit-51 commented 1 year ago

The algorithm used for the same is wrong. Try converting [a-b-c-d] and then try converting the output back to infix notation. It is easy to see that the potfix notation in the first place was wrong

raj457036 commented 1 year ago

Add a screenshot! Please

mudit-51 commented 1 year ago
image

Using your own infix->postfix tool, I get this as a result for [a-b-c-d]

image

Plugging the answer into your own postfix->infix tool, we don't get the original equation. This convertor works perfectly, which leads me to conclude that the issue is with the infix->postfix convertor

raj457036 commented 1 year ago

Thanks, @mudit-51 for bringing this up. I guess to fix the #5 I did miss some edge cases. I guess it has been fixed in the current version to tackle some extra edge cases which are not handled by the original algorithm so had to apply some modifications.