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

Explain the arrays in ruby, Explain the Arrays in Ruby Ruby arrays are ...

Explain the Arrays in Ruby Ruby arrays are dynamic arrays which expand automatically whenever a value is stored in a location beyond current end of the array. To the programmer

Explain about hubs, Hubs - In reality a multiport repeater - Connect...

Hubs - In reality a multiport repeater - Connects stations in a physical star topology - As well may create multiple levels of hierarchy to remove length limitation of 10

High-level and bubble algorithm , 1. Give both a high-level algorithm and a...

1. Give both a high-level algorithm and an implementation (\bubble diagram") of a Turing machine for the language in Exercise 3.8 (b) on page 160. Use the ' notation to show the co

B-tree of minimum degree t can maximum pointers in a node, A B-tree of mini...

A B-tree of minimum degree t can maximum pointers in a node T pointers in a node.

Algorithm to add element in the end of circular linked list, Q. Write down ...

Q. Write down an algorithm to add an element in the end of the circular linked list.        A n s . Algo rithm to Add the Element at the End of Circular Linked Lists

Structural Induction, Let a be a well-formed formula. Let c be the number o...

Let a be a well-formed formula. Let c be the number of binary logical operators in a. (Recall that ?, ?, ?, and ? are the binary logical operators). Let s be the number of proposit

Example of back face detection method, Example of Back Face Detection Metho...

Example of Back Face Detection Method To illustrate the method, we shall start with the tetrahedron (pyramid) PQRS of     Figure with vertices P (1, 1, 2), Q (3, 2, 3), R (1,

Process of post-order traversal, Post-order Traversal This can be done ...

Post-order Traversal This can be done both iteratively and recursively. The iterative solution would need a change of the in-order traversal algorithm.

Total impedent of the circuit, an electrical student designed a circuit in...

an electrical student designed a circuit in which the impedence in one part of a series circuit is 2+j8 ohms and the impedent is another part of the circuit is 4-j60 ohm mm program

Algorithm to delete node from binary search tree, Normal 0 fals...

Normal 0 false false false EN-IN X-NONE X-NONE MicrosoftInternetExplorer4

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