int main(int argc, char **argv) { BTNode *bt; int height, width, nleaf, nnode; char exp[] = "A(B(D,E(H(J,K(L,M(,N))))),C(F,G(,I)))"; bt = CreateBTNode(exp); DispBTNode(bt); puts(""); nnode = CountBTNode(bt); nleaf = CountLeaf(bt); printf("%d %d\n", nnode, nleaf); FindNode(bt, 'H'); height = BTNodeHeight(bt); width = CountWidth(bt); printf("%d %d\n", height, width-1); return 0; }
inline void BinarySearchTree<Key, Value>::CountLeaf (typename BinarySearchTree<Key, Value>::Node& subTree, int& outSum) { outSum=0; CountLeaf(subTree.getSelf(), outSum); }