pike.git / lib / modules / ADT.pmod / Heap.pike

version» Context lines:

pike.git/lib/modules/ADT.pmod/Heap.pike:1:   #pike __REAL_VERSION__      //! This class implements a (min-)heap. The value of a child node will   //! always be greater than or equal to the value of its parent node.   //! Thus, the top node of the heap will always hold the smallest value.      #define SWAP(X,Y) do{ mixed tmp=values[X]; values[X]=values[Y]; values[Y]=tmp; }while(0)    - protected private array values=allocate(10); - protected private int num_values; + protected array values=allocate(10); + protected int num_values;      #ifdef ADT_HEAP_DEBUG   void verify_heap()   {    for(int e=1; e<num_values; e++)    if(values[(e-1)/2] > values[e])    error("Error in HEAP (%d, %d) num_values=%d\n",    (e-1)/2, e, num_values);   }   #else