Questions tagged [polish-notation]

Polish notation, also known as Polish prefix notation or simply prefix notation, is a form of notation for logic, arithmetic, and algebra. Its distinguishing feature is that it places operators to the left of their operands. This tag and [tag:prefix-notation] are really synonyms.

Polish notation, also known as Polish prefix notation or simply prefix notation, is a form of notation for logic, arithmetic, and algebra. Its distinguishing feature is that it places operators to the left of their operands. If the arity of the operators is fixed, the result is a syntax lacking parentheses or other brackets that can still be parsed without ambiguity. The Polish logician Jan Łukasiewicz invented this notation in 1924 in order to simplify sentential logic.

The term Polish notation is sometimes taken (as the opposite of infix notation) to also include Polish postfix notation, or Reverse Polish notation, in which the operator is placed after the operands.

When Polish notation is used as a syntax for mathematical expressions by interpreters of programming languages, it is readily parsed into abstract syntax trees and can, in fact, define a one-to-one representation for the same. Because of this, Lisp (see below) and related programming languages define their entire syntax in terms of prefix notation (and others use postfix notation).

Wikipedia: http://en.wikipedia.org/wiki/Polish_notation

32 questions
-1
votes
1 answer

Reverse polish notation algorithm doesn`t work correctly with the same operands

I've written polish notation algorithm. But it doesn`t work properly, if there are the same operands between operator. If we run this code with current list ['a', '+', 'a', '*', 'b'], it will work properly, but if we change(b) on (a) it won't. The…
python_newbie
  • 23
  • 1
  • 7
-1
votes
1 answer

RPN calculator using linked list

I'm having trouble with my code. it seems to work only on single digit int. I don't know how to create a function that would work for int greater than 9. Also I don't know how to end the program if string is empty. Here's my code: #include…
1 2
3