dkh.container.pairingheap

  • Declaration

    struct PairingHeap(T, alias less = "a < b");

    Examples

    1. auto p1 = PairingHeap!int(); auto p2 = PairingHeap!int(); p1.insert(1); p1.insert(2); assert(p1.front == 2); p2.insert(3); assert(p2.front == 3); p1.meld(p2); assert(p1.length == 3 && !p2.length); assert(p1.front == 3); p1.removeFront(); assert(p1.front == 2); p1.removeFront(); assert(p1.front == 1); p1.removeFront();

    • Declaration

      const @property bool empty();

    • Declaration

      const @property size_t length();

    • Declaration

      void insert(T item);

    • Declaration

      inout inout(T) front();

    • Declaration

      void removeFront();

    • Declaration

      void meld(PairingHeap r);

      meld two heaps

      Warning: r become empty