DEV Community

Victor Hugo Grabowski Beltramini
Victor Hugo Grabowski Beltramini

Posted on

Data Structures: Introduction to Trees

So first of all Trees are a data structure that is used to store data in a hierarchical format, so trees are not a linear data structure. We can define a tree also as a collection of nodes where each node will contain a data value and a link to others child node.
In trees we do not store data in sequence, trees will store the data in multiples levels and multiples nodes.

Important terminologies

  1. Root
    In the trees the first node will always be the Root Node. Every tree will have one and only one root node, we also can say that the root is the origin in this kind of data structure.

  2. Edge
    All links between the nodes of the tree will be called as Edge, and in a tree with 'N' number of nodes will always have a maximum of 'N-1' number of edges.

  3. Parent
    The predecessor of any node is always called as Parent Node.

  4. Child
    The descendant of any node is called as Child Node

  5. Siblings
    All nodes that have the same Parent are called as Siblings, in other word all nodes with same parent are called Sibling nodes.

  6. Leaf
    All nodes that doesn't have a child node are called as Leaf Node.

Top comments (0)