I hope seeing the topic “Trees” people would think that here we have discussed about environment, plants, trees, life, etc. But only the students of Computer Science department would understand what we are going to discuss about here. Well by the topic name “Trees” we don’t mean the Trees of environment. Though the idea is derived from the same. It is actually a data structure of storing data in memory optimally.
So, Trees are actually the non linear and hierarchical type data structure which have their own functionalities and features in which these trees depends. Trees are the non linear data structures because of the nodes and vertices of the trees are of “n” order. Trees have the hierarchical structure because in trees the priority is decided according to the upper vertices or nodes where the operations from top to bottom and bottom to top show the hierarchy of the tree data structure. Now more important function of the trees are data abstraction and data encapsulation in which data abstraction means binding of the data members and the member functions which is used in the Java language and the data encapsulation means to encapsulate the data in certain partitions for the suitable use .
Trees are of many types binary tree, binary search tree etc. In binary tree one parent node have the two children on left and right side. And in this way every operation is started from the parent node then with help of the vertices the operation moves to the child nodes of the tree. Binary search tree is used for the searching purpose of the right result in the search within less time by this searching method and for the best result of the search in very short time two more methods are used that are:-
- Breadth first search (BFS)
- Depth first search (DFS)
These are the two best methods which are responsible for providing the best results in less time. So in the Breadth first search, the searching is starts from the top to the bottom where it reaches all the nodes and provides the best solution of the problem in less time and now in the Depth first search the searching is starts from the depth of the tree where it reaches the desired nodes to get the best solution for the problem. In this way these two search techniques or methods plays essential role in the tree. Trees are used in data structures in the way that whenever we develop the programs then we have to use the non linear data structures.
I hope I was able to clear out this topic. If you still have any doubt or query regarding this topic, you can place those in the comment box below. You are also most welcome to share your views and suggestion with us here.