Applications of Binary Trees
Applications of Binary Trees
1. Expression Tree:
A binary tree storing or representing an arithmetic expression is called as
expression tree.
A binary tree is the most suitable one for arithmetic expressions as it contains either
binary or unary operators. The expression tree for expression E, is shown in Fig.
2. 2. Decision tree:
The decision tree is a classifier in the form of a tree where each node is either a
branch node or a leaf node. Here the leaf node denotes the value of the target
attribute (class) of examples and the branch node is a decision node that denotes
some test to be carried out and takes a decision based on a single attribute value,
with one branch and sub tree for each possible outcome of the test.
For example, after testing a Boolean expression in an if statement ( C++) , the
program may execute the statements following it or the statements in the
corresponding else part.
We can visualize these different ways in which a program may execute through a
decision tree.
3. Huffman’s coding:
Let us consider an example. Let us use the sequence 00 to represent the letter ‘a’,
01 to represent letter ‘n’, and 0001 to represent the letter‘t’.
For example, the set {000, 001, 01, 10, 11} is a prefix code,
whereas the set {1, 00, 000, 0001} is not.
4. Game Trees:
One of the most exciting applications of trees is in games such as tic-tac-toe, chess,
nim, checkers, go, and so on.