This experiment guides you using trees tha can handle hierarchial data structure.Trees are an important data structure in Computer Science with applications to optimization, searching, sorting,and compilers.Tree can be defined recursively as follows. A tree is a collection of nodes. An empty collection of nodes is a tree. Otherwise a tree consists of a distinguished node r, called the root, and 0 or more non-empty (sub)trees T1, T2,...., Tk each of whose roots are connected by a directed edge from r.
We are normally used to infix notation. The postfix notation introduced by Hamblin turned out to be very useful for evaluating expressions. Some of the reasons are that the paranthesis can be dropped as the operator precedence is taken care of automatically. Here we will see another way of storing an expression, in the form of a tree, called the expression tree. An expression tree makes it easy to visualize the expression and evaluate it. An expression tree for an expression with only unary or binary operators is a binary tree where the leaf nodes are the operands and the internal nodes are the operators. We will also look at three types of tree traversals, which gives the three forms of writing an expression (Infix, Postfix and Prefix). Not only is evaluating expressions easier using expression trees, but it also facilitates code generation for expressions.