Binary Tree Question

Wong23 1 Tallied Votes 238 Views Share

Can someone help me with this problem here about Binary Trees. I was given this code...
and I am required to write a function void count_nodes(?) to determine the total number of nodes in a Binary Tree.

template <class dataType>
void postOrderTraverse (BinaryTree <dataType> * bt)
{
if (!(bt == NULL))
{
//traverse left child
postOrderTraverse (bt->left());
//traverse right child
postOrderTraverse (bt->right());
//visit tree
cout << bt->getData() <<"\t";
}
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.