How to find hierarchical tree last nodes c# : <p>I want to find last items of hierarchical tree.</p>

<pre><code>class Node
{
    public int Id { get; set; }
    public int ParentId { get; set; }
    public string Name { get; set; }
}
</code></pre>

<p><a href="https://i.stack.imgur.com/Ldz0p.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ldz0p.png" alt="enter image description here"></a></p>

<pre><code>    var list = new List&lt;Node&gt; {
        new Node {Id = 1, ParentId = 0, Name = "N 1"},
        new Node {Id = 2, ParentId = 1, Name = "N 1.1"},
        new Node {Id = 3, ParentId = 1, Name = "N 1.2"},
        new Node {Id = 4, ParentId = 2, Name = "N 1.1.1"},
        new Node {Id = 5, ParentId = 2, Name = "N 1.1.2"},
        new Node {Id = 6, ParentId = 2, Name = "N 1.1.3"}
    };
</code></pre>

<p>is this possible with c# or linq query?</p>
