write a recursive function that takes a pointer to the root node of a tree t and returns a pointer to the root node of the tree that results from removing all leaves from t

Respuesta :

The recursive function that  takes a pointer to the root node of a tree t and returns a pointer to the root node of the tree that results from removing all leaves from T is given as

void removeLeaves( Node * & t )

{

if( t == NULL || ( t->left == NULL && t->right == NULL ) )

{

t = NULL;

return;

}

removeLeaves( t->left );

removeLeaves( t->right );

}

What is a Recursive Function?

A Recursive function in the language of programming refers to a routine that requests services from itself directly or indirectly.

Learn more about Recursive Functions at;
https://brainly.com/question/11316313
#SPJ11