Expression Tree - Examples

<< Previous - Expression Tree

Next - Prefix Traversal >>






This page is specific for Examples of Expression Trees along with expressions. To learn about Expression Tree Traversals, please click on links above.

Expression Tree is used to represent expressions. Let us look at some examples of prefix, infix and postfix expressions from expression tree for 3 of the expresssions:

  • a*b+c
  • a+b*c+d
  • a+b-c*d+e*f

Expression Tree for a*b+c

Expressions from Expression Tree

Infix expression a * b + c
Prefix expression + * a b c
Postfix expression a b * c +



Infix, Prefix and Postfix Expressions from Expression Tree for a+b*c+d


Expression Tree for a + b * c + d can be represented as:

Expression Tree for a + b * c + d

Expressions for the binary expression tree above can be written as

Infix expression a + b * c + d
Prefix expression* + a b + c d
Postfix expressiona b + c d + *


Infix, Prefix and Postfix Expressions from Expression Tree for a+b-c*d+e*f


Expression Tree for a + b - c * d + e * f can be represented as:


Expression Tree for a+b-c*d+e*f

Expressions for the binary expression tree above can be written as

Infix expression a + b - c *d + e * f
Prefix expression* + a - b c + d * e f
Postfix expressiona b c - + d e f * + *



<< Previous - Expression Tree

Next - Prefix Traversal >>







Expression Tree - Examples

<< Previous - Expression Tree

Next - Prefix Traversal >>






This page is specific for Examples of Expression Trees along with expressions. To learn about Expression Tree Traversals, please click on links above.

Expression Tree is used to represent expressions. Let us look at some examples of prefix, infix and postfix expressions from expression tree for 3 of the expresssions:

  • a*b+c
  • a+b*c+d
  • a+b-c*d+e*f

Expression Tree for a*b+c

Expressions from Expression Tree

Infix expression a * b + c
Prefix expression + * a b c
Postfix expression a b * c +



Infix, Prefix and Postfix Expressions from Expression Tree for a+b*c+d


Expression Tree for a + b * c + d can be represented as:

Expression Tree for a + b * c + d

Expressions for the binary expression tree above can be written as

Infix expression a + b * c + d
Prefix expression* + a b + c d
Postfix expressiona b + c d + *


Infix, Prefix and Postfix Expressions from Expression Tree for a+b-c*d+e*f


Expression Tree for a + b - c * d + e * f can be represented as:


Expression Tree for a+b-c*d+e*f

Expressions for the binary expression tree above can be written as

Infix expression a + b - c *d + e * f
Prefix expression* + a - b c + d * e f
Postfix expressiona b c - + d e f * + *



<< Previous - Expression Tree

Next - Prefix Traversal >>