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

Chế độ phong kiến Việt Nam giữa thế kỉ XIX có điểm gì nổi bật? A. Chế độ quân chủ chuyên chế đang trong thời kì thịnh trị B. Chế độ quân chủ chuyên chế đang đượ
Question 1 (1 point) The perimeter of an iPad Air is 820 mm. Its length is 100 mm less than twice the width. If x = the length of the iPad Air and y = the width
find the derivative of y=(x³-5)⁴(x⁴+3)⁵ ​
what is the answer to (35+5)[16+(12÷ 4)]
Can u help solve this
PLEASE HELP, IGNORE ALL ANWSERS FILLED IN CURRENTLY I WILL GOVE BRAINLIST
All the employees were asked …………..the meeting on Saturday. A.attend B.attended C.attending D.to attend'
Câu 1 You …………wear a helmet when you are on a bike. A. have to B. shouldn't C. should D. must
2 accidentes que puede sufrir un fontanero, instalando una tubería.
Why did the US government choose to imprison Japanese Americans?