What Is Polish Notation in Data Structure?


Angela Bailey

What Is Polish Notation in Data Structure?

Polish Notation, also known as prefix notation, is a mathematical notation used to represent arithmetic expressions without the need for parentheses or operator precedence rules. Invented by the Polish mathematician Jan Lukasiewicz in the 1920s, it provides a simple and unambiguous way to express mathematical operations.

Advantages of Polish Notation

Using Polish Notation has several advantages over other notations like infix notation (the conventional notation). Let’s explore some of these advantages:

  • Clarity: Polish Notation eliminates ambiguity by placing operators before their operands. This removes the need for parentheses and ensures that there is no confusion about the order of operations.
  • Simplicity: The syntax of Polish Notation is straightforward and easy to understand once you become familiar with it.

    It consists of a sequence of operators followed by their corresponding operands.

  • Evaluation: Evaluating arithmetic expressions in Polish Notation can be done using a stack data structure. This allows for efficient processing since operators are always encountered before their corresponding operands.
  • Flexibility: Polish Notation allows for easy manipulation and conversion of expressions. It provides a solid foundation for implementing algorithms that involve parsing and evaluating mathematical expressions.

The Structure of Polish Notation

In Polish Notation, operators are placed before their operands. Consider the following expression in infix notation:
(3 + 4) * 5.

In Polish Notation, this expression would be represented as:
* + 3 4 5.

The general structure of a Polish Notation expression is as follows:

  • Operator Operand1 Operand2 .. OperandN

To evaluate an expression in Polish Notation, we start from the leftmost part and apply the operator to its operands. The process continues recursively until the entire expression is evaluated.


Let’s see a few examples to understand how Polish Notation works:

  • + 2 3: In infix notation, this would be 2 + 3, which equals 5.
  • * + 4 5 – 6 2: In infix notation, this would be (4 + 5) * (6 – 2), which equals 36.


Polish Notation provides a concise and unambiguous way to represent arithmetic expressions. It eliminates the need for parentheses and operator precedence rules, making it easier to understand and evaluate mathematical expressions.

While it may take some time to get used to the prefix notation, its advantages in terms of clarity, simplicity, evaluation efficiency, and flexibility make it a valuable concept in data structures and algorithms.

Discord Server - Web Server - Private Server - DNS Server - Object-Oriented Programming - Scripting - Data Types - Data Structures

Privacy Policy