binary search tree construction
Data Structure Notes

Binary Search Tree Problems and Solution

Binary Search Tree Problems and Solution

Binary Search Tree Problems are generally asked in GATE ,UGC NET exam and also in University examination.

There are two types of problems based on Binary Search Tree. These problems are

(1) Construct or Build a Binary Search Tree for given sequence of numbers.

(2) What will the Binary Search Tree after deleting Node from Binary Search Tree.

In this tutorial we have explained Insertion and Deletion based  Binary Search Tree problems with solution.

Problem Based on Binary Search Tree Insertion

Insertion in Binary Search Tree or Construct a Binary Search Tree from given sequence are discussed in this section.

Binary Search Tree Construction problems are asked in AKTU Data Structure Subject Exam.

Question 1 – Construct a Binary Search Tree (BST) for the following sequence of numbers  50, 70, 60, 20, 90, 10, 40

Solution – When we construct a Binary Search Tree from the given sequence of numbers then first number will always be considered as root of the tree.

50 will be root of Tree.

Step wise step Construction of Binary search Tree using the Binary Search Tree Insertion Algorithm is given here in picture

binary search tree construction

Binary Search Tree Construction

Questions 2

binary search tree construction

In the similar manner Students can attempt the questions 3 and questions 4 to build the Binary Search Tree

Question 3 – Construct a Binary Search Tree from the Given Values. [UPTU 2014-15]

                       49 , 22 , 25 , 90 ,82, 7 , 13 , 47, 49 , 63

Question 4 – Make a Binary Search Tree  for the following sequence [ UPTU 2015-16]

45 , 32 , 90 , 34 , 68, 72, 15, 24, 30, 66 , 11, 50, 10

Deletion in Binary Search Tree Problems

Problems Based on Deletion in Binary Search Tree Problems are explained in this section.

To Delete a node from Binary Search Tree we use the concepts of Three Cases od deletion in Binary Search Tree as discussed in Binary Search Tree Deletion Tutorial.

Case 1- If node to be deleted has no child then delete it from BST.

Case 2- If node to be deleted has one child then make a connection or link between it’s parent and child node and delete it.

Case  3- If node to be deleted has two children then swap it with it’s In Order Successor or In Order Predecessor and after swapping delete it.

 

binary search tree deletion

Binary Search Deletion problems

Conclusion and Summary

  • In this tutorial we have discussed the Binary Search Tree Problems with solution. Students can practice the given questions.
  • Problems based on Insertion in Binary Search Tree and Deletion in Binary Search Tree are solved and explained in this section.

Leave a Reply

Your email address will not be published. Required fields are marked *