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

1. when a homemade oil and vinegar salad dressing is left standing, it separates into layers. the salad dressing is a?solution,suspension, colloid, compound 2.w
patrick buys 12 bunches of bananas for $9 what will he pay for 8 bunches of bananas
find the length of the segment. round to the nearest tenth of a unit P(1,2) Q(5,4)
How do volvox get rid of waste/water?
What is the most abundant gas in the universe?
Why was Captain Smith given command of the Titanic?
What makes up about 50 percent of all land areas in the United States?
How do scientific theories differ from scientific laws?
what is 7/8 in a whole number
what is 3,490,000 in scientific notation