raj457036 / Simple-Tools

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

Wrong output with Infix->Postfix evaluation #1

Closed Nuthi-Sriram closed 3 years ago

Nuthi-Sriram commented 5 years ago

The output for converting from infix to postfix expression for some cases is producing a wrong output. Like in this case image But the expected output for this is supposed to be

image

The flaw in your algorithm is that image

Over here in your code, we can see that it is pushing the + operator into the stack eventhough there is a (-) operator in there, it is supposed to pop out the( - )operator first and then push in the + operator into the stack.

shreenanda-8 commented 4 years ago

Wrong output for A ( B + C ) D. The Correct answer is ABC+D. Not ABC+D**.

raj457036 commented 4 years ago

Thanks for using this repo. Btw I created this repo like 4-5 years back and now I do not maintain it or I cant maintain it coz of my other work.

So if any of you wanna contribute to this repo. I will welcome your PRs.

anubhavbagri commented 3 years ago

We would love to contribute bruh.

But could you please remove the GitHub pages since it appears as an infix to prefix converter website on google when someone searches for it. I lost marks in my paper (virtual exams RIP) since I copied from here that's why remove the pages hosting thing please!

Thanks in advance

Vedbhanushali commented 3 years ago

Yeah same here @anubhavbagri This repo comes first in google search result so many students who wrote the expression from here ,Now God help them..

raj457036 commented 3 years ago

Fixed!