• +91 9723535972
  • info@interviewmaterial.com

Data structure Interview Questions and Answers

Question - Explain how new data can be inserted into the tree?

Answer -

The following are the steps that you need to follow to insert the data into the tree:

  • First of all, check whether the data is unique or not ( i.e. check whether the data that you are going to insert doesn’t already exist in the tree).
  • Then check if the tree is empty. If the tree is empty then all you need to do is just insert a new item into the root.  If the key is smaller than that of a root’s key then insert that data into the root’s left subtree or otherwise, insert the data into the right side of the root’s subtree.

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners