# Postfix Expression from Expression Tree

Expression Tree is used to represent expressions. Let us look at how to traverse an expression tree to produce an postfix expression from expression tree:

## Generate Postfix Expression From Expression Tree

Let us how to generate the Postfix expression from tree. A postfix expression is generated from the tree as follows:

1. First consider the left subtree a * b.
• For a * b, consider the left subtree a. Left subtree has only one node a, Hence, first write the same.
`Postfix expression created so far = a `
• Consider the right subtree. Right subtree b is just a node.
`Postfix expression created so far = a b`
• Consider the root of subtree *.
`Postfix expression created so far = a b * `
2. Consider the right subtree c . Since the right subtree is just a simple node, there is no more subtrees to be checked
`Postfix expression created so far = a b * c `
3. Consider the root + .
`Postfix expression created so far = a b * c +`

## Postfix expression

`a b * c + `

# Postfix Expression from Expression Tree

Expression Tree is used to represent expressions. Let us look at how to traverse an expression tree to produce an postfix expression from expression tree:

## Generate Postfix Expression From Expression Tree

Let us how to generate the Postfix expression from tree. A postfix expression is generated from the tree as follows:

1. First consider the left subtree a * b.
• For a * b, consider the left subtree a. Left subtree has only one node a, Hence, first write the same.
`Postfix expression created so far = a `
• Consider the right subtree. Right subtree b is just a node.
`Postfix expression created so far = a b`
• Consider the root of subtree *.
`Postfix expression created so far = a b * `
2. Consider the right subtree c . Since the right subtree is just a simple node, there is no more subtrees to be checked
`Postfix expression created so far = a b * c `
3. Consider the root + .
`Postfix expression created so far = a b * c +`

## Postfix expression

`a b * c + `