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

contraceptive methods can be behavioral,barrier,or hormonal.which of these is a barrier method of contraception?
This country has Niagara Falls on its northern border a. Canadian Shield b. St. Lawrence River c. Arctic Circle d. United States e. Rocky Mountains f. British C
Break apart 372*7 multiplication
Identify the function of the phrase contained in the following sentence. Many scientists have been researching the possibility of Black Holes. subject direct ob
Elijah can read 75 words per minute . What is his speed in words per second
the Internet may best be compared to a/an
85 inches is how many feet and inches
Rooted plants are most likely found in which aquatic zone?
how did the hellenistic culture differ from the earlier greek culture
Oil is a fossil fuel which provides power to sustain a modern lifestyle. Which of these statements best describes an outcome of oil drilling? A.) Oxygen gas is