Expression Trees and Tree Traversal
6 flashcards · Computer Science · by Kalpana Satish
What is an expression Tree?
A binary expression tree is a specific kind of a binary tree used to represent expressions. The operands are attached as leaf nodes and operators become the internal nodes.
Types of Expression formats
Infix expression Prefix expression and Postfix expression
Construct Expression tree for 2 6 * 3 8 / +
Construct Expression tree for ( a + b* c ) + ( ( d * e + f ) * g)
Write the inorder, postorder and preorder traversal of the Expression Tree
Infix expression: (a+(b*c))+(d*(e + f)) Postfix Expression: a b c * + d e f + * + Prefix Expression: + + a * b c * d + e f
Write the inorder, postorder and preorder traversal of the Expression Tree
Inorder : a + b * c + 7 Pre order: + * 7 + c a b Post order : a b + c * 7 +