-
-
Notifications
You must be signed in to change notification settings - Fork 46.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is a missing check for the "associativity" of the operators in the stacks/infix_to_postfix_conversion.py file. #8673
Labels
Comments
amirsoroush
added a commit
to amirsoroush/PythonAlgorithms
that referenced
this issue
Apr 19, 2023
…ks/infix_to_postfix_conversion.py
14 tasks
Hi @amirsoroush, does it still available to fix? I would like to work on this issue. Could you please assign me in it? Thank you. |
@h-muhammed Hi. Actually I fixed it by this PR but it hasn't reviewed by the maintainers yet. I would be glad if you review it. |
tianyizheng02
added a commit
that referenced
this issue
Aug 1, 2023
#8674) * fixes #8673; Add operator's associativity check for stacks/infix_to_postfix_conversion.py * fix ruff N806 in stacks/infix_to_postfix_conversion.py * Update data_structures/stacks/infix_to_postfix_conversion.py Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com> * Update data_structures/stacks/infix_to_postfix_conversion.py Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com> --------- Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
sedatguzelsemme
pushed a commit
to sedatguzelsemme/Python
that referenced
this issue
Sep 15, 2024
…ks/infix_to_p… (TheAlgorithms#8674) * fixes TheAlgorithms#8673; Add operator's associativity check for stacks/infix_to_postfix_conversion.py * fix ruff N806 in stacks/infix_to_postfix_conversion.py * Update data_structures/stacks/infix_to_postfix_conversion.py Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com> * Update data_structures/stacks/infix_to_postfix_conversion.py Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com> --------- Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Repository commit
1158294
Python version (python --version)
Python 3.10.6
Dependencies version (pip freeze)
astroid==2.11.3
bcc==0.18.0
black==22.3.0
blinker==1.4
Brlapi==0.8.3
certifi==2020.6.20
chardet==4.0.0
Expected behavior
Hi, In the data_structures/stacks/infix_to_postfix_conversion.py file, when we pass
"2^3^2"
argument to theinfix_to_postfix
function, it should return'2 3 2 ^ ^'
back. This results in number512
which is the correct calculation.Actual behavior
Currently
infix_to_postfix("2^3^2")
returns'2 3 ^ 2 ^'
which is wrong. If we calculate it, it returns number64
.The reason behind this is that currently we don't have any check for the "associativity" of the operators. In particular
^
operator causes problem here. It hasRight-To-Left
associativity.The text was updated successfully, but these errors were encountered: