I have a function that returns the first node of a tree,
node* primeiro(tree r){
while(r->left != NULL){
r = r->left;
}
return r;
}
BTW, the percuss is made in order. So the function returns the leftmost leaf of the tree and the function presumes that the tree is not empty. How can I implement this in a recursive way?
node* primeiro (tree r) {
while (r->left != NULL) {
r = primeiro (r->left);
}
return r;
}
This is not working.