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 pink panther?
There are some cases where distance time graph of a particle is vertical . So could you please tell me when it is possible????
did dinosaurs really have brains in their tails?
find the zeros of y=x²-1 from a graph.
jem boy wants to make his 8-meter square pool into a rectangular one by increasing its length by 2m and decreasing its width by 2m .jem boy asked your expertise
In the given figure , if angel ROQ = 90 and angel POS : angel ROS = 4 : 5 , then the value of angel SOQ is
jem boy wants to make his 8-meter square pool into a rectangular one by increasing its length by 2m and decreasing its width by 2m .jem boy asked your expertise
did dinosaurs really have brains in their tails?
1 pound = 100 penny = 10 penny x 10 penny = 1/10 pound x 1/10 pound = 1/100 pound = 1 penny => 1 pound = 1 penny How is this possible if 1 pound = 100 pen
what is quicksand? how does it work?