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

With regards to the American Revolution, what do these people have in common?
Which caused people to leave England and go to America in the 1600s? A. civil war and looting B. poverty and overcrowding C. tyranny and oppression D. earth
What issue were the Virginia and New Jersey Plans attempting to resolve?
Why can't chemical changes be reversed? examples to explain
What times what equals 180
Why are hurricanes considered more damaging than tornadoes when tornadoes have stronger winds
Why are hurricanes considered more damaging than tornadoes when tornadoes have stronger winds
what is an antonym for stern lecture
Write a paragraph explaining how trade encouraged the development of the Renaissance
Round to the merest hundredth389.993