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

What statement regarding the diagram is true?
In what way did British leaders misunderstand the Revolutionary War?
Which sentence is written the most clearly and coherently? A. A decision was reached by the coach to put Anderson in as the starting quarterback. B. Triath
Which of these techniques do writers employ to draw a reader's attention to symbols in their stories?
The tickets in a box are numbered from 1 to 20 inclusive. If a ticket is drawn at random and replaced, and then a second ticket is drawn at random, what is the
Why did the Republican Party split and what was the result
What fraction of a minute is 42 seconds
what is the answer to decrease 2500 by 1%
___ cables are continually being improved to increase speed. the fastest cables under development today use multiple cores and/or multiple wavelengths to transm
Beginning inventory is $12,000: purchases are $34,000: sales revenue are $60,000: and cost of goods sold is $31,000. how much is ending inventory?