The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time. Tom Cargill
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,