Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. public void insert(int value) { // complete this function
  2.  
  3. heapArray.insertAtEnd(value);
  4. int currNode = getSize();
  5. System.out.println(heapArray.length);
  6. System.out.println(heapArray.access(currNode));
  7. while(currNode > 0 && heapArray.access(getParentIndex(currNode)) > heapArray.access(currNode)) {
  8. swap(heapArray.access(getParentIndex(currNode)),heapArray.access(currNode));
  9. currNode = getParentIndex(currNode);
  10.  
  11.  
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement