public void insert(double key, V value) {
        HeapNode node = new HeapNode(key, value);
        heap_size++;
        int i = heap_size;
        while (i > 1 && ar[parent(i)].getKey() > key) {

            ar[i] = ar[parent(i)];
            ar[i].setIndex(i);
            i = parent(i);
        }
        ar[i] = node;
        ar[i].setIndex(i);
        this.resizeArray();
    }