Trees


Trees are widely used data structure. In this chapter we will try to unveil some of the key terms related to key, organization of a tree, and how a tree can be made. Let’s see the general structure of a tree

In the above tree, we can see that the Node “P” is the top most node and it is called “Root”

Q ,R and S are linked to P and they are called the children of P.

P is the parent. Q ,R and S are known as siblings.

T,U and V are the children of Q and, they are siblings.

If you observe above, we have not restricted the number of the children that a node can have.(there are some special type of trees, where the number of children is limited.)

What is a tree node?

The tree can be defined as a collection of nodes in a particular fashion. So what is a node?

A node is a data object which consists of some “actual” data and some pointers for connecting this node with the other nodes so that the structure of the tree is formed. See below a typical node.

some terminology:

Height of a Node: