Expression Trees and Tree Traversal

6 flashcards · Computer Science · by Kalpana Satish

  1. 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.

  2. Types of Expression formats

    Infix expression Prefix expression and Postfix expression

  3. Construct Expression tree for 2 6 * 3 8 / +

  4. Construct Expression tree for ( a + b* c ) + ( ( d * e + f ) * g)

  5. 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

  6. 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 +