buggautt9171 buggautt9171
  • 24-08-2019
  • Computers and Technology
contestada

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

Respuesta :

ExieFansler ExieFansler
  • 27-08-2019

Answer:

  1. if root node is NULL then return new node with data equal mentioned.
  2. If the data <root->data
  3. root->left=recursive call on left subtree.
  4. else if data >root->data
  5. root->right =recursive call on right subtree.
  6. 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.

Answer Link

Otras preguntas

Your heart rate measurement when you are not exercising is your
Which of the following examples describes a behavioral pattern that results from a proximate cause?A) A cat kills a mouse to obtain nutrition.B) A male sheep fi
Please help and thank you
Which of these best describes Earth’s core? A/ Most dense layer, consists of the outer and inner parts. B/ Thinnest under the oceans and thickest under continen
HELP NOW PLEASE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
NEED MATH HELP!!!! ( with the 2 problems I missed)
Why does a personal text message carry a different syntax than most essays?
why do people catch attitudes for no reason
NEED HELP ASAP, WILL GIVE BRIANLIEST!! What do the carpenters begin doing on Mars? (Question from "February 2002: The Locusts") A) Demolishing Martian structure
Please help me! ASAP