clarifications in postfix notation

This commit is contained in:
sejo 2024-03-09 12:46:45 +01:00
parent 46d7ba9ad7
commit 09ea42025d
1 changed files with 2 additions and 2 deletions

View File

@ -48,7 +48,7 @@ this implies that it is primarily based on interactions with a "push down stack"
## postfix addition
in postfix notation, the addition of two numbers would be written in the following form:
in postfix notation, the addition of two numbers, 1 and 48, would be written in the following form:
``` 1 48 +
1 48 +
@ -86,7 +86,7 @@ we can also write it in many other ways, for example:
48 3 5 + 2 / +
```
make sure these expressions work and are equivalent! you just have to follow these rules, reading from left to right:
i invite you to make sure these expressions work and are equivalent! you just have to follow these rules, reading from left to right:
* if it's a number, push it down onto the stack
* if it's an operator, take two elements from the top of the stack, apply the operation, and push the result back onto the stack.