Insert Item
void insert(Bheap *H, int item)
{
    int cur;
    H->array[++H->cnt] = item;
    cur = H->cnt;
 
    while (1) {
        if (cur/2 >= 1 && H->array[cur] < H->array[cur/2]) {
            swap(H, cur, cur/2);
            cur /= 2;
        }
        else
            break;
    }
}
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License