Tree Data Structure in Hindi: Height, Depth, Order, and Degree Explained

Tree Data Structure in Hindi: Height, Depth, Order, and Degree Explained


Tree data structure computer science में एक बहुत important topic है, जो hierarchical structure को represent करता है. इस blog में हम कुछ important terms जैसे height, depth, order, degree, etc. को समझेंगे, जो trees के साथ जुड़े होते हैं.

 

1. Tree (ट्री)

Tree एक non-linear data structure है, जिसमें nodes hierarchical way में arranged होते हैं. इसमें एक root node होता है और बाकी के nodes sub-trees में divide होते हैं, जो parent-child relationship को follow करते हैं।

Example 

        A

      /   \

    B       C

   / \       / \

  D   E   F   G

 

  1. A root है

  2. B, C are children of A

  3. D, E, F, G are leaf nodes.

 

2. Node (नोड)

Node एक basic unit होती है tree की. हर node में एक data value stored होती है और उससे जुड़े pointers होते हैं, जो next nodes (children) को point करते हैं।

  1. Parent (पेरेन्ट): जिस node से कोई child connected होता है उसे parent कहते हैं।

  2. Child (चाइल्ड): Parent से directly connected node को child कहा जाता है।

 

3. Root (रूट)

Root tree का सबसे topmost node होता है, जिसे parent नहीं होता. यह tree की शुरुआत करता है।

 

4. Height of Tree (ट्री की ऊँचाई)

Height of a tree, root से लेकर सबसे दूर वाले leaf तक की longest path को represent करता है। Tree की height को हम leaf nodes से measure करते हैं।

Formula:

  • Height of a tree = Height of root node

Example:

        A

      /   \

    B       C

   / \     

  D   E   

 

  1. इस tree में, root से सबसे दूर वाला leaf node D या E है।

  2. Path length = 2 (A -> B -> D), so height = 2.


 

5. Depth of a Node (नोड की गहराई)

Depth किसी भी node की root से distance को बताती है, यानी root से उस node तक कितने edges हैं।

Example:

         A (Depth 0)

      /   \

    B(1)   C(1)

   /  \     

  D(2) E(2)

 

  1. A की depth 0 है (क्योंकि ये root है)

  2. B और C की depth 1 है

  3. D और E की depth 2 है।

 

6. Degree of a Node (नोड की डिग्री)

Degree of a node को हम उस node के directly connected child nodes की संख्या के रूप में define करते हैं।

Example:

 

        A

      /   \

    B       C

   / \     

  D   E   

 

  1. Node A की degree 2 है (क्योंकि इसके दो child हैं, B और C)

  2. Node B की degree 2 है (क्योंकि इसके दो child हैं, D और E)

  3. Nodes D, E, C की degree 0 है (क्योंकि इनके कोई child नहीं हैं)

 

7. Leaf Node (लीफ नोड)

Leaf node वह node होता है, जिसके कोई children नहीं होते। यह tree का आखिरी node होता है।

        A

      /   \

    B       C

   / \     

  D   E   

 

  • D, E, C are leaf nodes because they have no children.

 

8. Internal Node (आन्तरिक नोड)

Internal node वह node होता है, जिसके एक या उससे ज्यादा children होते हैं।

        A

      /   \

    B       C

   / \     

  D   E   

 

  1. A और B internal nodes हैं, क्योंकि इनके child nodes हैं।

 

9. Subtree (सबट्री)

Subtree एक tree का ही हिस्सा होता है, जो किसी भी node और उसके children से मिलकर बनता है। हर node अपने आप में एक subtree represent करता है।

 

10. Order of Tree (ट्री का क्रम)

Order of a tree, maximum number of children किसी भी node के हो सकते हैं, उसे represent करता है। For example, अगर tree का order 3 है, तो इसका मतलब है कि tree में किसी भी node के maximum 3 children हो सकते हैं।

Example

Binary tree का order 2 होता है, मतलब किसी भी node के maximum 2 children हो सकते हैं।

        A

      /   \

    B       C

 

इस tree का order 2 है क्योंकि हर node के maximum 2 children हैं।

 


 

इन definitions को समझने के बाद, आप tree data structure को और बेहतर तरीके से समझ सकते हैं। Tree structures का use विभिन्न algorithms और databases में किया जाता है, जैसे binary search trees, AVL trees, B-trees, etc.

 

Conclusion:

Tree एक versatile और powerful data structure है, जिसे समझना programming और algorithms की दुनिया में बहुत जरूरी है। Height, depth, order, और degree जैसी terms को समझकर आप trees के बारे में advanced topics आसानी से सीख सकते हैं।

 

Related Articles

Dijkstra’s Shortest Path Algorithm in Hindi

Graphs एक महत्वपूर्ण data structure है, और कई समस्याओं का स...

Read More →

Minimum Spanning Tree (MST) - Kruskal और Prim’s Algorithms

Graphs में Minimum Spanning Tree (MST) एक बहुत ही महत्वपूर्ण concept है...

Read More →

Graph Traversal Techniques: Depth First Search (DFS) और Breadth First Search (BFS) Explained

Graphs एक महत्वपूर्ण data structure हैं, जो कि विभिन्न problem ...

Read More →

Graph in Data Structure in Hindi: Directed और Undirected Graphs

Graphs (ग्राफ) एक महत्वपूर्ण डेटा स्ट्रक्चर हैं ज...

Read More →

B-Tree और B+ Tree क्या है? Difference और Uses हिंदी में |

B-Tree और B+ Tree Data Structure: Introduction और Uses   B-Tree ...

Read More →