size_t BinTree<T>::leafCount(Node_T *&p) { if(p->m_pChildren[0]) return leafCount(p->m_pChildren[0]) + (p->m_pChildren[1]) ? leafCount(p->m_pChildren[1]) : 0; else return (p->m_pChildren[1]) ? leafCount(p->m_pChildren[1]) : 1; return 0; }
int leafCount (TNODE_p_t root) { if (root == NULL) return 0; if (root->left == NULL && root->right == NULL) return 1; int leftCount = leafCount(root->left); int rightCount = leafCount(root->right); return (leftCount + rightCount); }
size_t BinTree<T>::leafCount() { //G) return leafCount(m_pRoot); }
size_t TreeHelper<T>::getBinaryTreeLeafCount(const Tree* tree) { size_t leafCount(0); countBinaryTreeLeaf(tree->root(), leafCount); return leafCount; }