Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Removing the Min Element from Deaps
Now we shall explain the technique for removing the min elements in the deap data structure. During deletion, our main target to delete the minimal value from deaps. As the height of the tree is always log n, it consumes time of order of log n. We can discuss deletion operation as follows −
Procedure deap_deletion(b[],m):
if(m<2)
return; //There are no elements.
min=b[2]; //Minimum value is saved
for (i=2;2*i<=m;b[i]=b[k],i=k){
k=i*2;
If(k+1<=m && b[k]>b[k+1])
k++;
}
k=max_value(i);
if(x>b[k]){
b[i]=b[k];
insert y into maximum subtree;
} else {
insert y into minimum subtree;
} Advertisements
