Tree
Basic terminology
Static representation of treeDynamic representation of treeTypes of TreeThe tree data structure can be classified into six different categories. General TreeGeneral Tree stores the elements in a hierarchical order in which the top level element is always present at level 0 as the root element. All the nodes except the root node are present at number of levels. The nodes which are present on the same level are called siblings while the nodes which are present on the different levels exhibit the parentchild relationship among them. A node may contain any number of subtrees. The tree in which each node contain 3 subtree, is called ternary tree. ForestsForest can be defined as the set of disjoint trees which can be obtained by deleting the root node and the edges which connects root node to the first level node. Binary TreeBinary tree is a data structure in which each node can have at most 2 children. The node present at the top most level is called the root node. A node with the 0 children is called leaf node. Binary Trees are used in the applications like expression evaluation and many more. We will discuss binary tree in detail, later in this tutorial. Binary Search TreeBinary search tree is an ordered binary tree. All the elements in the left subtree are less than the root while elements present in the right subtree are greater than or equal to the root node element. Binary search trees are used in most of the applications of computer science domain like searching, sorting, etc. Expression TreeExpression trees are used to evaluate the simple arithmetic expressions. Expression tree is basically a binary tree where internal nodes are represented by operators while the leaf nodes are represented by operands. Expression trees are widely used to solve algebraic expressions like (a+b)*(ab). Consider the following example. Q. Construct an expression tree by using the following algebraic expression. (a + b) / (a*b  c) + d Tournament TreeTournament tree are used to record the winner of the match in each round being played between two players. Tournament tree can also be called as selection tree or winner tree. External nodes represent the players among which a match is being played while the internal nodes represent the winner of the match played. At the top most level, the winner of the tournament is present as the root node of the tree. For example, tree .of a chess tournament being played among 4 players is shown as follows. However, the winner in the left subtree will play against the winner of right subtree.
Next TopicBinary Tree
