You are on page 1of 4

Ulysses Urich D.

Duran AI22 DSA

1. M
2. B, F, C, K, V, N, Z, H, A, G, R, J, S, E, L and P
3. {BFCKVN} {FKVN} {C} {K} {V} {N} {ZHAG} {HAG} {AG} {G} {RJS} {J} {S} {ELP} {LP} {P}
4. {BFCKVN = 2} {FKVN = 3} {C = 0} {K = 0} {V = 0} {N = 0} {ZHAG = 1} {HAG = 1} {AG = 1} {G
= 0} {RJS = 2} {J = 0} {S = 0} {ELP = 1} {LP = 1} {P = 0}
5. 4
6. K, V, N, C, G, J, S, and P
7. M, B, Z, R, E, F, H, L and A
8. F and C
9. R
10. {B, Z, R, E} {F,C} {J,S} {K,V,N}
11. E
12. F, B and M
13. 5
14. 5

2. Convert the following postfix statements into expression trees:


a. AB/CD+*
a. AB/CD+*

/ +

A D
B C
b. ABCDE+-/+

+c. /

D E - A

B
C

3. Convert the following arithmetic expressions into expression trees:


a. (A - B) + (C * (D - E))
Postfix Notation: AB-CDE-*+

- *

A B - C

D E
b. M + N – O / P
Postfix Notation: MN+OP/-

+ /

M P
N O

You might also like