Código Java Notación polaca-polaca Inversa
1. (8*7+6/3)+(7/3*5-3+6)
NOTACION POLACA
PREORDEN: + + * 8 7 / 6 3 + - * / 7 3 5 3 6 | |||
OPERADOR | OPERANDO | OPERANDO | RESULTADO |
* | 8 | 7 | ++(8*7)/63+-*/73536 |
/ | 6 | 3 | ++(8*7)(6/3)+-*/73536 |
+ | (8*7) | (6/3) | +(8*7+6/3)+-*/73536 |
/ | 7 | 3 | +(8*7+6/3)+-*(7/3)536 |
* | (7/3) | 5 | +(8*7+6/3)+-(7/3*5)36 |
- | (7/3*5) | 3 | +(8*7+6/3)+(7/3*5-3)6 |
+ | (7/3*5-3) | 6 | +(8*7+6/3)(7/6*5-3+6) |
+ | (8*7+6/3) | (7/3*5-3+6) | (8*7+6/3)+(7/3*5-3+6) |
NOTACION POLACA INVERSA
POSTORDEN: 8 7 * 6 3 / + 7 3 / 5 + 3 – 6 + + | |||
OPERANDO | OPERANDO | OPERADOR | RESULTADO |
8 | 7 | * | (8*7)63/+73/5*3-6++ |
6 | 3 | / | (8*7)(6/3)+73/5*3-6++ |
(8*7) | (6/3) | + | (8*7+6/3)73/5*3-6++ |
7 | 3 | / | (8*7+6/3)(7/3)5*3-6++ |
(7/3) | 5 | * | (8*7+6/3)(7/3*5)3-6++ |
(7/3*5) | 3 | - | (8*7+6/3)(7/3*5-3)6++ |
(7/3*5-3) | 6 | + | (8*7+6/3)(7/3*5-3+6)+ |
(8*7+6/3) | (7/3*5-3+6) | + | (8*7+6/3)+(7/3*5-3+6) |
public class ArbolBinarioExp
Comentarios
Publicar un comentario