TREE ================================================================================ A Tree is a non-linear data structure and a hierarchy consisting of a collection of nodes such that each node of the tree stores a value and a list of references to other nodes (the “children”). A tree consists of a root, and zero or more subtrees T 1 , T 2 , … , T k such that there is an edge from the root of the tree to the root of each subtree. Basic Terminologies: Parent Node: The node which is a predecessor of a node is called the parent node of that node. {B} is the parent node of {D, E} . Child Node: The node which is the immediate successor of a node is called the child node of that node. Examples: {D, E} are the child nodes of {B}. Root Node: The topmost node of a tree or the node which does not have any parent node is called the root node. {A } is the root node of the tree. A non-empty tree must contain exactly one root node and exactly one path from the root to all other no
Comments
Post a Comment