You can not have great software without a great team, and most software teams behave like dysfunctional families. Jim McCarthy

Tree Implementation

Language Java | Level Intermediate | Category Data structure | September 6, 2015 12:33 am


Data structure Description

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.


Output

   					 

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,

				    

Comments


No comments available!

Please login to add comments.