Ask Question

C+ + write a simple pseudo code to insert a new node to Binary Search Tree.

+2
Answers (1)
  1. 25 May, 12:44
    0
    if root node is NULL then return new node with data equal mentioned. If the data data root->left=recursive call on left subtree. else if data >root->data root->right = recursive call on right subtree. At last return root.

    Explanation:

    Node is always inserted at the at the leaf node. We will search the data in the tree if we hit a the leaf node the new node is inserted as the child of the leaf node.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “C+ + write a simple pseudo code to insert a new node to Binary Search Tree. ...” 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