Expression Trees in data structure

Binary trees are widely used to store algebraic expressions. For example, consider the algebraic expression given as:

Exp = (a – b) + (c * d)

Expression Trees

Expression Trees
Expression Trees

Example Given an expression, Exp = ((a + b) – (c * d)) % ((e ^f) / (g – h)), construct the corresponding binary tree.

Expression tree
Expression tree

Leave a Comment