code: public void build(final LNGIntVector ns) {
      for (int i = 0; i < this.heap.size(); i++)
        this.indices.set(this.heap.get(i), -1);
      this.heap.clear();
      for (int i = 0; i < ns.size(); i++) {
        this.indices.set(ns.get(i), i);
        this.heap.push(ns.get(i));
      }
      for (int i = this.heap.size() / 2 - 1; i >= 0; i--)
        this.percolateDown(i);
    }
docs: Rebuilds the heap from a given vector of elements.
  @param ns the vector of elements