Doesn't work #1

yuriyzubarev opened this Issue Mar 23, 2012 · 1 comment


None yet

1 participant


Try this and you will see:

assert infix_to_prefix("a+b") == "ab+"
assert infix_to_prefix("(a+(b*c))") == "abc*+"
assert infix_to_prefix("((a+b)*(z+x))") == "ab+zx+*"
assert infix_to_prefix("((a+t)*((b+(a+c))^(c+d)))") == "at+bac++cd+^*"
assert infix_to_prefix("c+d*b/(a-e)^b^c") == "cdb*ae-bc^^/+"

First of all parsing is not problem free. Once you get passed it, the algorithm itself is flawed.

Your work is referenced from Wikipedia, you better fix it up :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment