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

evaluate the expression. write answer without exponets64 to the 1/2 power
16x=10(x+1)=26(+1)-16
Which measures would be the side lengths of a right triangle? A. 2 cm, 5 cm, 7 cm B. 9 cm, 14 cm, 17 cm C. 7 cm, 17 cm, 24 cm D. 5 cm, 12 cm, 13 cm
What is kirchoff s law???
How much is 22 percent of 200 gallons? 37 meters is 74 percent of what distance?
Solve.[tex] \sqrt{x-1}+3=x [/tex]
Which of these equations represent functions? Check all that apply. A. y = (x - 2)^2 + 5 B. x^2 - 4y^2 = 1 C. y = 3x - 3 D. y = 4x^5
103 is 20% of what number
in a rational no. twice the numerator is 2 more than the denominator. if 3 is added to each, the numerator or the denominator, the new fraction is 2/3. find the
Please help punitive 1. out in the open 2. of or related to punishment 3. of or relating to trees 4. not subject to injury