<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Viren Rakholiya on Medium]]></title>
        <description><![CDATA[Stories by Viren Rakholiya on Medium]]></description>
        <link>https://medium.com/@viren-devr3?source=rss-c04019f8b1c1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Viren Rakholiya on Medium</title>
            <link>https://medium.com/@viren-devr3?source=rss-c04019f8b1c1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 19:02:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@viren-devr3/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Tree: Non-Linear Data Structure]]></title>
            <link>https://viren-devr3.medium.com/data-structure-tree-4f77268063fc?source=rss-c04019f8b1c1------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f77268063fc</guid>
            <category><![CDATA[trees]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[datastrucutre]]></category>
            <dc:creator><![CDATA[Viren Rakholiya]]></dc:creator>
            <pubDate>Mon, 10 May 2021 12:34:48 GMT</pubDate>
            <atom:updated>2021-05-15T06:33:29.387Z</atom:updated>
            <content:encoded><![CDATA[<p>Tree is a non-linear data structure. We all know about commonly used linear data structure, such as array, stack, queue and linked list. Simply, In these data structures, all the elements are arranged in a linear sequence. <strong>But, why non-linear data structure is introduced ?</strong> Because, The usage of linear data structures is not possible for some complex applications. For instance,</p><ul><li>General Trees</li><li>Graphs</li><li>Multi-link Polynomials &amp; So on…</li></ul><p>Don’t worry, these will be elaborated in next posts. So, Chill!</p><h3>Definition of Tree(Non-Linear DS):</h3><blockquote>A tree data structure is defined as a collection of objects or entities known as <strong>nodes</strong> that are linked together to represent or simulate hierarchy.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*KSTJPHkyLpMM4bsgz2TRbw.png" /><figcaption>Fig. 1. Tree</figcaption></figure><p>Simply, Tree is a hierarchical data structure which stores the information naturally in the form of hierarchy style.</p><h3>Terminologies of Trees:</h3><p>Mainly, there are 13 common terms which are normally used while working on trees. (<strong>Highlight</strong>: Think like actual tree and it’s branches &amp; leaves OR family tree, you will easily get all the definitions)</p><ol><li><strong>Root node:</strong> Root is a unique node in the tree &amp; further subtrees are attached to it.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/1*CHtGdND8D-go08wjDASrSQ.png" /><figcaption>Fig. 2. Root node is 10.</figcaption></figure><p><strong>2. Parent node:</strong> The node having further subbranches is called parent node</p><p><strong>3. Child node:</strong> The child node is a sub-node of parent node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/303/1*xGePAcrzVygRyDiNb4ICnQ.png" /><figcaption>Fig. 3. Parent and child node</figcaption></figure><p><strong>4. Leaf node: </strong>Terminal node is called leaf node of tree.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/1*Q15WWIrHOb9i96bLo2_C_g.png" /><figcaption>Fig. 4. Leaf nodes or Leaves</figcaption></figure><p><strong>5. Degree of node: </strong>The total number of subtrees attached to that node is called degree of node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/302/1*LNcqQnsU9_STZygoccjSbQ.png" /><figcaption>Fig. 5. Degree of particular node</figcaption></figure><p><strong>6. Degree of tree: </strong>The maximum degree in the tree is a degree of tree.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*V_U5g7VhNsrk6ZnTX_QmLg.png" /><figcaption>Fig. 6. Degree of a tree</figcaption></figure><p><strong>7. Level of tree: </strong>The level of a node 𝑛 is the number of edges on the path from the root node to 𝑛. The <strong>root</strong> node is always considered at level <strong>zero</strong>. Furthermore, the adjacent nodes to root are supposed to be at level 1 and so on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*kg0j0BLVH0tjUuuqlK1FfA.png" /><figcaption>Fig. 7. Node at each level</figcaption></figure><p><strong>8. Height of tree: </strong>The maximum level of tree is a height of tree.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/403/1*fT5y6KiqVBnr_yTRgqlAeA.png" /><figcaption>Fig. 8. Height of tree</figcaption></figure><p><strong>9. Predecessor: </strong>If some particular node occurs previous to some other node then that node is called predecessor to the other node.</p><p><strong>10. Successor: </strong>it is a node which occurs next to some node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/246/1*gh2vQVxCqCNSshaKeQdJxQ.png" /><figcaption>Fig. 9. Predecessor and Successors</figcaption></figure><p><strong>11. Internal &amp; External node: </strong>External node is basically leaf node as it doesn’t have any child node. While, at least one child branch having node is called internal node. Here, 20,40, 30 &amp; 70 are internal nodes. Whereas, remaining are external nodes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/303/1*6wuW1zZqmpeTZTmOJck_1g.png" /><figcaption>Fig. 10. Internal and external nodes</figcaption></figure><p><strong>12. Sibling node: </strong>The nodes with common parent are called sibling node. Here, 40, 50 &amp; 60 are each other’s sibling nodes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/196/1*IbjDTlRN8XpSvBYngtXAmA.png" /><figcaption>Fig. 11. Sibling nodes</figcaption></figure><p><strong>13. Forest: </strong>Forest is a collection of disjoint trees. After eliminating root node from a tree, then it’s a forest!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/1*8Wb5tyw0CmsM1SgZaOsHcA.png" /><figcaption>Fig. 12. Eliminating root node 10</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/379/1*gtNQho8UHnpS_SBu1mX6-A.png" /><figcaption>Fig. 12. A collection of disjoint trees: Forest</figcaption></figure><p><strong>To wrap up…</strong></p><p>So, It is straightforward to understand all common terms of tree &amp; feel free to ask questions in comment box.</p><p>Now, It’s the end of article on definition and basic terminologies of data structure tree. In upcoming articles, I will cover series on Binary tree.</p><p>Thanks for reading!</p><h4><strong>To be continued…</strong></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f77268063fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>