Ubah bentuk infix berikut ini ke dalam Prefix
1. A + ( B * C - ( D / E * F ) * G ) * H
/ D E * F
* / D E F
B * C - * / D E F
* B C - * / D E F
- * B C * / D E F
- * B C * / D E F * G
* - * B C * / D E F G
* - * B C * / D E F G
A + * - * B C * / D E F G * H
+ A * - * B C * / D E F G * H
* + A * - * B C * / D E F G H
2. ( ( A + B ) / A ) ^ ( ( E – F ) * G )
+ A B / A
/ + A B A
- E F * G
* - E F G
/ + A B A ^ * - E F G
^ / + A B A * - E F G
Ubah kedalam bentuk Postfix
1. A * B - ( C + D ) - ( E – F ) + F / H ^ I
C + D
C D +
E - F
E F -
C D + - E F -
C D + E F - -
A * B
A B *
A B * - C D + E F - -
A B * C D + E F - - -
A B * C D + E F - - - ^ I
A B * C D + E F - - - I ^
A B * C D + E F - - - I ^ / H
A B * C D + E F - - - I ^ H /
A B * C D + E F - - - I ^ H / + F
A B * C D + E F - - - I ^ H / F +
2. A * ( B + D ) / E – F * ( G + H / K )
B + D
B D +
G + H / K
G H + K /
A * B D + / E
A B D + *
A B D + * E /
F * G H + K /
F G H + K / *
A B D + * E / - F G H + K / *
A B D + * E / F G H + / * -
0 komentar:
Posting Komentar