InFix PreFix PostFix Notation A Level Computer Science
- Slides: 14
In-Fix Pre-Fix Post-Fix Notation A Level Computer Science
Methods of Notation • 4+2 • In-fix • +42 • Pre-fix • Polish Notatation • 42+ • Post-fix • Reverse Polish Notation (RPN)
Infix to RPN Examples • • • 2*(A+B) (Infix) 2*(AB+) x*y xy* 2 AB+* (RPN)
Infix to RPN Examples • • • (A+B)*2 (Infix) (AB+)*2 x*y xy* AB+2* (RPN)
Infix to RPN Examples • • • (A+B)/(C*D) (Infix) (AB+)/(CD*) x/y xy/ AB+CD*/ (RPN)
Infix to RPN Examples • • ((1 + 2) * 4) + 3 (Infix) ((12+)*4)+3 (x*y)+z (xy*)+z (12+4*)+3 x+y xy+ 12+4*3+ (RPN)
Binary Tree – Post Order + * a • Post Order • ab*c+ c b
Infix to Post Fix Conversion using Stacks Order of precedence for operators * / + If an operator is pushed onto stack and the operator below it is of higher or equal precedence remove bottom item from stack • If an operator is pushed onto stack and the operator below it is of a lower precedence operators remain on stack • •
Infix to Post Fix Conversion using Stacks • • 4 + 2 * 5 (Infix) 4 2 5 * + (RPN) * + Stack 42 5 * + String
Infix to Post Fix Conversion using Stacks • 4 * 2 + 5 (Infix) • 4 2 * 5+ (RPN) + * + Stack 42*5 + String
Infix to Post Fix Conversion using Stacks • 4 - 2 + 5 (Infix) • 4 2 – 5 + (RPN) + + Stack 42 - 5 + String
Infix to Post Fix Conversion using Stacks • 4 / 2 * 5 (Infix) • 4 2 / 5 * (RPN) * / * Stack 42/ 5 * String
Evaluate RPN in Stack • ab*c+ • (a*b)+c (Infix) • • Push operands When reach operator evaluate previous 2 operands Pop 2 operands Push evaluation a b a (a*b) c (a*b)+c
Evaluate RPN in Stack • • • fgh*+ f+(g*h) (Infix) f=3 g=4 h=5 3 4 3 5 4 3 (4*5)20 3 3+(4*5)23 3
- Infix notation to prefix notation
- Infix to polish notation
- Infix prefix postfix
- Ee-456
- Infix to postfix in c
- Algorithm for infix to postfix conversion
- Lisp polish notation
- Cafeteria stack
- Prefix computer science
- What is your favourite lesson
- Worksheet 2 searching algorithms answers
- A level computer science exemplar candidate work
- Computer science revision a level
- How would 13800 volts be written in metric notation
- Lxwxh meaning