void del(int x) { heapSwap(x, size); index.erase(heap[size].key); --size; heapUp(x); heapDown(x); }
void heapUpdate(int pos) { if (heapPos[pos] == -1) { addHeap(pos); } else { heapUp(heapPos[pos]); } }
void insert(const HeapNode& hn) { if (++size == heap.size()) heap.push_back(HeapNode()); heap[size].key = hn.key; heap[size].val = hn.val; index[hn.key] = size; heapUp(size); }
void insert(int key, int val) { if (++size == heap.size()) heap.push_back(HeapNode()); heap[size].key = key; heap[size].val = val; index[key] = size; heapUp(size); }
void FastMarchingMethod::heapAdd(const DXY &dxy) { if (static_cast<int>(narrowBand_.size()) < size_ + 1) narrowBand_.resize(size_*2 + 1); narrowBand_[size_] = dxy; indexOf(dxy) = size_++; heapUp(size_-1); }
void GramHeap::insert(GramNode* node) { if(_used < _size) { _data[_used] = node; heapUp(_used); _used++; return; } if(gramNodeCmp(node, _data[0]) < 0) return; //! just abandom older _data[0] _data[0] = node; heapDown(0); }
void addHeap(int pos) { heap[heapSize] = pos; heapUp(heapSize++); }