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.
- Recursive Case:
- 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
- Proto Van Emde Boas Trees | Set 4 | Deletion
- Van Emde Boas Tree - Set 3 | Successor and Predecessor
- Van Emde Boas Tree | Set 1 | Basics and Construction
- 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
- Proto Van Emde Boas Tree | Set 6 | Query : Successor and Predecessor
- Van Emde Boas Tree | Set 2 | Insertion, Find, Minimum and Maximum Queries
- proto van Emde Boas Trees | Set 1 (Background and Introduction)
- AVL Tree | Set 2 (Deletion)
- Ternary Search Tree (Deletion)
- Gap Buffer | Deletion Operation
- Insertion and Deletion in Heaps
- Skip List | Set 3 (Searching and Deletion)
- Fibonacci Heap - Deletion, Extract min and Decrease key
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.