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

Find the 6th term in the expanded form of the equation (2x+y)^9
what are the rational numbers of -12,0,35,4.85,√12,√36,19/6,-10/11,1.4949949994
resources are an integral part of human survival.yet indiscriminate use of them by humans has led to a crisis situation."discuss the above ststement in light of
a sum of RS 500 is in the form of denominators of RS5 & RS 10..if the total no. of notes is 90 ,find the no. of notes of each type................
Round 1.069 to the nearest tenth
Collect information about working of geyser and prepare a report
what does 'secret, black and midnight hags' mean in shakespeare?
What national symbol is common to China and Wales ?
what is 12.345 rounded to the nearest tenth
Find the 6th term in the expanded form of the equation (2x+y)^9