0% found this document useful (0 votes)
9 views23 pages

Infix to Prefix Expression Conversion

The document explains the conversion of infix expressions to prefix notation with several examples. It highlights operator precedence and associativity rules, demonstrating how to rearrange expressions accordingly. Key concepts include the handling of parentheses, operator precedence, and the associativity of operators like addition, multiplication, and exponentiation.

Uploaded by

deekshasn18
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views23 pages

Infix to Prefix Expression Conversion

The document explains the conversion of infix expressions to prefix notation with several examples. It highlights operator precedence and associativity rules, demonstrating how to rearrange expressions accordingly. Key concepts include the handling of parentheses, operator precedence, and the associativity of operators like addition, multiplication, and exponentiation.

Uploaded by

deekshasn18
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

INFIX TO PREFIX

Infix expression Prefix expression Explanation


A+B +AB The operator +
moves before its two operands, A and B.
A+B*C +A*BC Multiplication (*) has a higher
precedence than addition (+). The * is
applied to B and C first, so *BC is formed. The + then applies to A
and the result of *BC to form +A*BC.

(A + B) * (C + D) *+AB+CD The innermost parentheses are


converted first. (A + B) becomes +AB
and (C + D) becomes +CD. The final operation, *, is then moved
to the front to combine the results.

A*B+C*D +*AB*CD Both * operations have higher


precedence than +. They are
converted first (*AB and *CD). The + is then placed at the
beginning.

A+B+C ++ABC Because + is left-associative, (A + B) is


evaluated first, becoming
+AB. The expression then becomes (+AB) + C, which is Converted
to ++ABC.

A^B^C ^A^BC The exponentiation operator ^ is right-


associative. This means A

You might also like