Tree Representation as Array in Hindi

Tree Representation an Array

Array के द्वारा binary tree को प्रदर्शित करने के लिए tree के node की numbering करनी होती है । किसी भी tree के node की numbering करने के लिए हम binary tree को full binary tree मानकर हार node को एक number दे देते है और जिस number पर वह node होता है उसे array मे store कर देते है ।

Example:-

 

Link List Representation of Binary Tree: –

किसी भी tree को linked list द्वारा सही से प्रदर्शित किया जा सकता है । हम जानते है की एक binary tree मे अधिकतम दो child node ही होते है अतः इस प्रकार के representation मे node value के दोनों और एक एक pointer maintain करते है । जिससे उसकी child node को प्रदर्शित किया जाता है tree का वह भाग जिसमे किसी सूचना को स्टोर नहीं किया जाता है उन्हे NULL के द्वारा सुरक्षित रखा जाता है

 

Leave a Comment