Please check previous sets of Proto Van Emde Boas Tree article first. It is highly recommended.
Procedure for delete:
- Base Case: If we reach at Proto VEB with size 2 then we will check for whether the key is present or not if yes then we assign the pointer to nullptr which will set false to it presence.
- We recursively call delete function over the cluster of the keys i.e. high(key) and its position low(key).
- After we delete the key from the cluster (after we reach to the base case) we check whether there are any other keys are present in the cluster. If there is any key present then we can not set the summary to nullptr otherwise we will set the summary to nullptr by calling delete over summary.
Lets understand 1 delete on Proto-VEB of size 4:
First it will recursively call delete(cluster, 1).
So now the base case is satisfied so it will go at position 1 in the cluster Proto-VEB and will set it to nullptr if it is present.
Now we will check if any more keys are present in cluster (see the for loop in delete), 0 is present so delete(summary, 0) call is not going to execute and summary will remain same.
See the image below to understand it:
Follow the instructions written near the boxes from top to bottom.
Below is the implementation:
Recurrence Relation for Delete:
T(u) = T(u) = 2T()) + O(log2())
Time Complexity : O(log2(u)*log2(log2(u)))
- proto van Emde Boas Trees | Set 1 (Background and Introduction)
- 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 4 | Deletion
- Van Emde Boas Tree - Set 3 | Successor and Predecessor
- Van Emde Boas Tree | Set 1 | Basics and Construction
- Van Emde Boas Tree | Set 2 | Insertion, Find, Minimum and Maximum Queries
- AVL Tree | Set 2 (Deletion)
- Insertion and Deletion in Heaps
- Gap Buffer | Deletion Operation
- Skip List | Set 3 (Searching and Deletion)
- Ternary Search Tree (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 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.
Improved By : shubham_singh