Write a recursive function that counts the number of nodes in a binary tree of integers.


Difficulty level
This exercise is mostly suitable for students
int nb_node_rec(Btree B)
{
	if (B == NULL)
		return 0;
	return 1 + nb_node_rec(B->left) + nb_node_rec(B->right);
}

Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Removing a sequence of 3 characters from a string