Binary Expression Trees

A binary expression tree is a specific kind of a binary tree used to represent expressions. Two common types of expressions that a binary expression tree can represent are algebraic expressions and boolean expressions. These trees can represent expressions that contain both unary and binary operators.

Algebric Expression Trees

An algebric expression such as (3 * 7) + 9 consists of:

• Operands such as 3, 7, 9 or x, y, z,
• Binary Operators such as +, – , *, /, DIV, MOD, ^
• Unary Operators such as –

Algebric expressions can be represented using a binary expression tree where:

• Each node is an operator,
• Each leaf is an operand. Algebric Expression: (view solution) Algebric Expression: (view solution) Algebric Expression: (view solution) Algebric Expression: Algebric Expression: Algebric Expression:

Boolean Expression Trees

An Boolean expression such as (A OR B) AND C consists of:

• Operands such as A, B, C,
• Binary Operators such as AND, OR, XOR
• Unary Operators such as NOT

Boolean expressions can be represented using a binary expression tree where:

• Each node is an operator,
• Each leaf is an operand. Boolean Expression: (view solution) Boolean Expression: (view solution) Boolean Expression: Boolean Expression:
Tagged with: