PairingHeap

struct PairingHeap (
T
alias less = "a < b"
) {}

Members

Functions

meld
void meld(PairingHeap r)

meld two heaps Warning: r become empty

Examples

1 auto p1 = PairingHeap!int();
2 auto p2 = PairingHeap!int();
3 
4 p1.insert(1);
5 p1.insert(2);
6 assert(p1.front == 2);
7 
8 p2.insert(3);
9 assert(p2.front == 3);
10 
11 p1.meld(p2);
12 assert(p1.length == 3 && !p2.length);
13 
14 assert(p1.front == 3); p1.removeFront();
15 assert(p1.front == 2); p1.removeFront();
16 assert(p1.front == 1); p1.removeFront();

Meta