Question: 1- please send me the remaining part of this code which is the implementation of the Binomial heap(insertion and display of the minimum element) const

1- please send me the remaining part of this code which is the implementation of the Binomial heap(insertion and display of the minimum element)

const int MAXN = 100005;

struct node { int degree; int key; node *child, *sibling;

node(int k) { degree = 0; key = k; child = sibling = NULL; } };

node *head = NULL;

node *merge(node *h1, node *h2) { if (h1 == NULL) { return h2; } if (h2 == NULL) { return h1; } node *merged_heap = NULL; node *prev = NULL, *curr = NULL, *next = NULL; if (h1->degree <= h2->degree) { merged_heap = h1; h1 = h1->sibling; } else { merged_heap = h2; h2 = h2->sibling; } curr = merged_heap; while (h1 != NULL && h2 != NULL) { if (h1->degree <= h2->degree) { curr->sibling = h1; h1 = h1->sibling; } else { curr->sibling = h2; h2 = h2->sibling; } curr = curr->sibling; } if (h1 != NULL) { curr->sibling = h1; } else { curr->sibling = h2; } return merged_heap; }

node *merge_binomials(node *h1, node *h2) { node *h = merge(h1, h2); if (h == NULL) { return h; } node *prev = NULL, *curr = h, *next = h->sibling; while (next != NULL) { if (curr->degree != next->degree || (next->sibling != NULL && next->sibling->degree == curr->degree)) { prev = curr; curr = next; } else { if (curr->key <= next->key) { curr->sibling = next->sibling; next->sibling = curr->child; curr->child = next; curr->degree++; } else { if (prev == NULL) { h = next; } else { prev->sibling = next; } curr->sibling = next->child; next->child = curr; curr = next; } } next = curr->sibling; } return h; }

node *insert(int key) { node *newnode = new node(key); head = merge_binomials(head, newnode); return head; }

node *reverse(node *curr)

2- please provide me C++ program for the Huffman coding using bitwise operators. I already asked you many times but when you are sent the code was not completed

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!