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

The employees from maintenance go for coffee together every day at 9 AM. On Monday, Hector paid $5.45 for three cartons of milk, four cups of coffee and seven
What is square root of 81
What type of weather is associated with this symbol L
The corner where the states of Utah, New Mexico, and Colorado meet is called the Four Corners. Identify a pair of vertical angles. Justify your response.
Narrative paragraph example
Find a number that is more than 50 but less than 100. When the number divided by 7, the remainder is 4. When the number is divided by 10, the remainder is 8. Wh
Candace said I'm thinking of a fraction. If I divide it by 1/2,I get 3/11.what fraction was Candace thinking of??
why did advances industry occur mainly in the north? please Answer
If the The length of a rectangle is 5cm longer than twice the length of the width and the area if the rectangle is 403 square centimeters,what is the width?
What is square root of 81