In C language only with these struct node and struct heap Suppose that the heap data structure is implemented with the modified binary tree nodes defined below.
- The parent variable in the node data structure is a pointer on the parent of the corresponding node (providing access from a node to its parent). The variable 'last_added' in the batch data structure shows the sign of the latest 'node' to data making
struct node {
int key;
struct node * parent, * left_link, * right_link;
};
struct heap {
struct node * root;
struct node * last_added;
}
void heap_insert(struct heap *heap,int key){
//-- the code --
}
Aucun commentaire:
Enregistrer un commentaire