It is highly recommended to read the previous articles on Van Emde Boas Tree first.
Procedure for Delete:
Here we are assuming that the key is already present in the tree.
- First we check if only one key is present, then assign the maximum and minimum of the tree to null value to delete the key.
- Base Case: If the universe size of the tree is two then, after the above condition of only one key is present is false, exactly two key is present in the tree (after the above condition turns out to false), So delete the query key by assigning maximum and minimum of the tree to another key present in the tree.
- If the key is the minimum of the tree then find the next minimum of the tree and assign it as the minimum of the tree and delete query key.
- Now the query key is not present in the tree. We will have to change the rest of the structure in the tree to eliminate the key completely:
- If the minimum of the cluster of the query key is null then we will delete it from summary as well. Also, if the key is the maximum of the tree then we will find new maximum and assign it as the maximum of the tree.
- Otherwise, if the key is maximum of the tree then find the new maximum and assign it as the maximum of the tree.
Below is the series of images representing ‘delete key-0 query’ over the VEB Tree with 0, 1, 2 keys are present:
Step 1: As 0 is the minimum of the tree, it will satisfy the first condition of else part of the algorithm.
First, it finds the next maximum which is 1 and set is as minimum.
Step 2: Now it will delete key 1 from the cluster.
Step 3: Next condition, cluster has no key, is true, so it will clear the key from the summary as well.
1 2 2 0 1 4
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Proto Van Emde Boas Trees | Set 4 | Deletion
- Proto Van Emde Boas Tree | Set 2 | Construction
- Proto Van Emde Boas Tree | Set 3 | Insertion and isMember Query
- Proto Van Emde Boas Tree | Set 5 | Queries: Minimum, Maximum
- Van Emde Boas Tree | Set 1 | Basics and Construction
- Proto Van Emde Boas Tree | Set 6 | Query : Successor and Predecessor
- Van Emde Boas Tree | Set 2 | Insertion, Find, Minimum and Maximum Queries
- Van Emde Boas Tree - Set 3 | Successor and Predecessor
- proto van Emde Boas Trees | Set 1 (Background and Introduction)
- AVL Tree | Set 2 (Deletion)
- m-Way Search Tree | Set-2 | Insertion and Deletion
- Ternary Search Tree (Deletion)
- Skip List | Set 3 (Searching and Deletion)
- Fibonacci Heap - Deletion, Extract min and Decrease key
- Insertion and Deletion in Heaps
- Gap Buffer | Deletion Operation
- Maximum sub-tree sum in a Binary Tree such that the sub-tree is also a BST
- Convert a Generic Tree(N-array Tree) to Binary Tree
- Overview of Data Structures | Set 3 (Graph, Trie, Segment Tree and Suffix Tree)
- Tournament Tree (Winner Tree) and Binary Heap
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.