There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies. C.A.R. Hoare
The tree is a data structure which consist the tree node and organized the nodes in the hierarchy. Each node contains value and list of reference to other nodes in the tree. The tree is a non-linear and hierarchical data structure. Example, represent family members using tree data structure. The tree is best data structure to use the recursive function. Tree can contain the following properties.
|Two nodes have the same parents called siblings.|
|An internal node has children nodes.|
|External node or leaves do not have any children.|
|Ancestors of the node is a list of node from current (Or ancestor) node to root node.|
|Descendants of node are list of direct and indirect children nodes of descendant (current) node|
Write a program to implement Tree data structure.
List of items in the Tree: 11 42 99 33 9 22 67 76 99 Depth First Iteration from Tree: 11,42,99,33,9,22,67,76,99, Breadth First Iteration from Tree: 11,42,67,76,99,99,33,9,22,