You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Heap (6)public boolean change(int index, int newValue) {if (index < 0 || index >= currentSize)return false;int oldValue = heapArray[index].getKey(); // remember oldheapArray[index].setKey(newValue); // change to newif (oldValue < newValue) // if raised,heapfyUp(index); // trickle it upelse// if lowered,heapfyDown(index); // trickle it downreturn true;} // end change()29