glendaward4164 glendaward4164
  • 21-08-2019
  • Computers and Technology
contestada

Write a short recursive method that will find and return the leftmost node of a binary tree. Presume the method will initially be called with the root node as its input argument.

Respuesta :

ExieFansler ExieFansler
  • 28-08-2019

Answer:

Node * leftmost(Node * root)

{

 if(root==NULL)

return NULL;

return leftmost(root->left);

}

Explanation:

This is the function to return the leftmost node of the Binary tree in C++.Return type of the function is Node.If root is NULL then we are returning NULL because there is no tree.Now we have to make a recursive call on root->left.

Answer Link

Otras preguntas

What are the answers to numbers 7,10,12
Witch characteristics are not necessarily true of all living things
In at least 150 words, identify and describe the setting, and the way the author uses imagery to describe it for Part 1 of Nectar in a Sieve. Just a brief summa
true or false..How do I know if it's no solution
Select the correct answers (2 answers) stating what happens in Interphase A DNA Duplication B Chromosomes lining up in the middle of the cell C Growth D Cytopla
What property of real numbers is shown
BRAINLIEST!PLEASE HELP ME
Select the best word or phrase to complete each sentence. 1. La doctora Salazar me recomienda un ____ de pies a cabeza. examen médico tobillo consultorio 2. El
Pls help! an example of denaturation isA) water removed from a checial reactionB) a polypeptide chain formingC) a protein unreveling
a Ferrel so moved betweenA. 0° to 30° latitudeB. 30° to 60° latitudeC. 60° to 90° latitude