Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Finding child Nodes of a node in a tree

$
0
0
Hello all I need to find the child nodes of a node in a binary tree.I was just wondering if this will return the number of child nodes thanks.
        public int FindChildNodes()
        {
            if (RightNode == null && LeftNode == null)
            {
                return 1;
            }
            else
            {
                return RightNode.FindChildNodes() + LeftNode.FindChildNodes();
            }
        }


Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>