Deletion of a node from a binary search tree, Data Structure & Algorithms

Assignment Help:

The algorithm to delete any node having key from a binary search tree is not simple where as several cases has to be considered.

  • If the node to be deleted contains no sons, then it might be deleted without further adjustment to the tree.
  • If the node to be deleted contains only one subtree, then its only son may be moved up to take its space.
  • The node p to be deleted contain two subtrees, then its inorder successor s have to take its place. The inorder successor could not contain left subtree. Hence, right son of s can be moved up to gain the place of s.

Example: Assume the following cases wherein node 5 have to be deleted.

1. The node to be deleted has no children.

2390_Deletion of a node from a Binary Search Tree.png

3. The node to be deleted contains two children. This case is complicated. The order of the binary tree has to be kept intact.


Related Discussions:- Deletion of a node from a binary search tree

Define rule-based expert system, 1. Define the following terms in a rule-ba...

1. Define the following terms in a rule-based expert system? a) Knowledge base b) Inference engine 2. What is a fuzzy rule? Explain the difference between classical and fuzzy

Algorithms, 2. Write a note on i) devising ii) validating and...

2. Write a note on i) devising ii) validating and iii) testing of algorithms.

Define the term - array, Define the term - Array A fixed length, ord...

Define the term - Array A fixed length, ordered collection of values of same type stored in contiguous memory locations; collection may be ordered in several dimensions.

Standard ways of traversing a graph, Q. Which are the two standard ways of ...

Q. Which are the two standard ways of traversing a graph?  Explain them with an example of each.  Ans:   T he two ways of traversing a graph are written below

Heap sort, We will start by defining a new structure called Heap. Figure 3 ...

We will start by defining a new structure called Heap. Figure 3 illustrates a Binary tree. Figure: A Binary Tree A complete binary tree is said to assure the 'heap con

Deletion, sir how can i explain deletion process in a data structure

sir how can i explain deletion process in a data structure

Complexity of quick sort, Q. What do you mean by the best case complexity o...

Q. What do you mean by the best case complexity of quick sort and outline why it is so. How would its worst case behaviour arise?

Assignment, How do I submit a three page assignment

How do I submit a three page assignment

Insertion of element into a linked list, ALGORITHM (Insertion of element in...

ALGORITHM (Insertion of element into a linked list) Step 1 Begin the program Step 2 if the list is empty or any new element comes before the start (head) element, then add t

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd