You are on page 1of 2

30 September 2021

Qu construct a tree with the following items

(a) Horse, Fox, Dog, Zebra, Wolf, Tiger, Cat, Bat

Horse

Fox Zebra

Postfix:
Dog wolf Bat Cat Dog Fox Tiger Wolf Zebra Horse

Cat Tiger

Bat
at

REVERSE POLISH NOTATION (RPN)

Infix Expression:
Eg1 Write the infix expression (a+b) * (a-c) into Reverse Polish Notation (RPN)

*
-
+
a c
a b

In RPN a b + a c - *

Eg1 Write the infix expression ((7 – 9 )/8) – ( 2 *(4-C)) into Reverse Polish Notation (RPN)

-
/
*
- 8
2 -

-
7 -

9 -

4
-

c
- -

Answer: 7 9 – 8 / 2 4 c - * - -
-

Left, Right, Root

You might also like