# 🌳 Tree Terminology Explained (Data Structures Made Simple)

Trees are one of the most important **non-linear data structures** in computer science. If you’re learning **DSA**, **Java**, **Python**, or preparing for **coding interviews**, understanding tree terminology is essential.

In this blog, we’ll break down **tree terminology** simply and intuitively, with examples you can easily visualise.

---

## 🌱 What Is a Tree?

A **tree** is a hierarchical data structure made up of **nodes**, where:

* One node is the **root**
    
* Each node can have **children**
    
* There are **no cycles**
    
* Every node (except the root) has exactly **one parent**
    

Real-life examples:

* File systems
    
* Organization charts
    
* HTML DOM
    
* Decision trees
    

---

## 🧩 Basic Tree Terminology

### 1️⃣ Node

A **node** is the basic unit of a tree.  
Each node contains:

* Data (value)
    
* References to its child nodes
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1766075988930/59e86fee-7dde-45f7-b9f6-4701d533578a.png align="center")

---

### 2️⃣ Root Node

The **root** is the topmost node of the tree.

* It has **no parent**
    
* Entry point of the tree
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1766076095102/bf1d5950-fccd-4fc0-9871-5e1daa6964cc.jpeg align="center")

---

### 3️⃣ Parent Node

A **parent** is a node that has one or more child nodes.

Example:

* N1 is the parent of N2 and N3
    

---

### 4️⃣ Child Node

A **child** is a node that descends from a parent.

Example:

* N3 and N2 are children of N1
    

---

### 5️⃣ Sibling Nodes

Nodes that share the **same parent** are called siblings.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1766076267705/61989945-2700-403d-b7bb-8d424a8b2328.jpeg align="center")

---

### 6️⃣Leaf Node (External Node)

A **leaf node** is a node with **no children**.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1766076328753/6090755b-7359-4b56-95bd-24cdaa0a7d83.jpeg align="center")

---

### 7️⃣Edge

An **edge** is the connection between two nodes.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1766076519313/2b68ca3f-eb14-4c23-b7a1-1923c4ca6bcb.jpeg align="center")

---

### 8️⃣ Ancestor

An **ancestor** of a node is any node on the path from the root to that node.

Example:

* Ancestors of N7: N4, N2, N1
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1766076671268/e5f617cf-ec56-47cb-af65-91e2df71acda.jpeg align="center")

---

### 9️⃣ Depth of a Node

The **depth** of a node is the number of edges from the **root to that node**.

* Depth of Node N4 = 2
    
* Depth of Root N1 = 0
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1766076824484/696afb89-8ad4-4a82-9c8b-06f1615b57e4.jpeg align="center")

---

### 🔟 Height of a Node

The **height** of a node is the number of edges on the **longest path from that node to a leaf**.

* Height of a leaf node = 0
    
* Height of a Node N3=1
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1766077185562/32c3fea0-0816-4892-bf9e-cc2256132f55.jpeg align="center")

---

### 1️⃣1️⃣ Height of a Tree

The **height of a tree** is the height of the root node.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1766077280786/9ae229ef-7258-4597-a9b8-8da2ac6671dd.jpeg align="center")

---

## Why Tree Terminology Matters

Understanding tree terminology helps you:

* Write clean recursive algorithms
    
* Understand Binary Trees, BSTs, AVL Trees, and Heaps
    
* Solve interview problems confidently
    
* Navigate real-world structures like file systems
    

---

## Happy Learning!

Trees can seem intimidating at first, but a solid grasp of the core terminology makes them far easier to understand. Once these fundamentals are clear, topics like traversals, balanced trees, and even graphs become much more approachable.

If this guide helped you, feel free to share it with fellow DSA learners.  
Happy coding! 🌳

---
