Ask Question

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.

+4
Answers (1)
  1. 18 May, 21:53
    0
    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.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a short recursive method that will find and return the leftmost node of a binary tree. Presume the method will initially be called ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers