Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. abstract class Heap {
  2.  
  3. private int data[]; //the heap implemented using an array
  4. private int size; //how large of a heap
  5. private int numberOfElements; //how many items currently in the heap
  6.  
  7. public Heap( int size ) {
  8.  
  9. this.size = size;
  10. this.data = new int[ size + 1 ];
  11. this.numberOfElements = 0;
  12. }
  13.  
  14. public abstract void insert( int data );
  15.  
  16. public abstract void delete( int data );
  17.  
  18. }
  19.  
  20. class MinHeap extends Heap {
  21.  
  22. //call super() and use the three data fields above
  23. //of course here I will add the abstract methods insert and delete
  24. //and code them according to the min heap specifications
  25. }
  26.  
  27. class MaxHeap extends Heap {
  28.  
  29. //call super() and use the three data fields above
  30. //of course here I will add the abstract methods insert and delete
  31. //and code them according to the maxheap specifications
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement