Alle boeken

Professioneel

Apps Over Coach Inloggen Begin met lezen

Computer Science · Begrippenlijst

Wat is Postfix notation?

Definition 24.5 High School Computer Science · Hoofdstuk 24 — Linked Lists, Stacks and Queues

In postfix notation, an operator is written after its two operands: 3+43 + 4 is 3 4 +, and (3+4)×2(3 + 4) \times 2 is 3 4 + 2 *. No brackets and no priority rules are needed: the order of the operators says everything.

The stack while 3 4 + 2 * is read, one picture per token. An operator replaces the two numbers on top by its result (shaded); 14 is left alone at the end.
The stack while 3 4 + 2 * is read, one picture per token. An operator replaces the two numbers on top by its result (shaded); 1414 is left alone at the end.
Lees in het hoofdstuk →