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 is the smallest unit of life in the human body?
Non-Fiction Writing Challenges
If a glass rod is rubbed with a dry cloth, what kind of charge would it be: A) positive, due to extra protons B)negative,due to protons lost C) positive due t
Sanjay has ordered 30 slices of pizza for 7 people, including himself. If everyone gets an equal share, how many slices will each person get and what is the rem
Which of the following explains why f(x)= log4x does not have a y-intercept
Classical Conditioning and problematic behavior ​
What are generated at transform fault plate boundaries?
| Jill needs to buy some campingequipment. A sleeping bag costs$21.75, a compass costs $5.38and a water jug costs $2.98. Howmuch money does Jill need tobuy the
Johannes want to earn at least $350 per week. His work week is 40 hrs, what is the minimum hourly wage he must make?
What type of negative business message does this statement convey? We sincerely regret that we are unable to offer a replacement for the toaster oven because th