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

How far will a migrating bird travel if they fly at a speed of 6.2 m/s for 10.0 hours?
Which laws directed the flow of goods between england and the colonies? A) Navigation Acts B) Merchant's Pledge C) Colonists' Rights Law D) Colonies' Char
The sum of two numbers is 45 . The larger number is 7 more than the smaller number. What are the numbers?
a person who agreed with Hamilton's viewpoint in a quote would say
what are the abiotic elements of the ocean? :) :) :) :)
7x+8(x+1/4)=3(6x-9)-8
The sum of two numbers is 45 . The larger number is 7 more than the smaller number. What are the numbers?
why were advances in transportation and communication important to the second industrial revolution
three friends share a pizza divided into eighths if each person eats one slice how many more slices must be eaten so that one half of the pieces remains
why were advances in transportation and communication important to the second industrial revolution