public int NumberOfLeafNodes()
            {
                if (main == null)
                {
                    return(0);
                }

                return(main.NumberOfLeafNodes());
            }
            public int NumberOfLeafNodes()
            {
                if (this.leftUnit == null && this.rightUnit == null)
                {
                    return(1);
                }

                int leftLeaves  = 0;
                int rightLeaves = 0;

                if (this.leftUnit != null)
                {
                    leftLeaves = leftUnit.NumberOfLeafNodes();
                }

                if (this.rightUnit != null)
                {
                    rightLeaves = rightUnit.NumberOfLeafNodes();
                }

                return(leftLeaves + rightLeaves);
            }