Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- abstract class Heap {
- private int data[]; //the heap implemented using an array
- private int size; //how large of a heap
- private int numberOfElements; //how many items currently in the heap
- public Heap( int size ) {
- this.size = size;
- this.data = new int[ size + 1 ];
- this.numberOfElements = 0;
- }
- public abstract void insert( int data );
- public abstract void delete( int data );
- }
- class MinHeap extends Heap {
- //call super() and use the three data fields above
- //of course here I will add the abstract methods insert and delete
- //and code them according to the min heap specifications
- }
- class MaxHeap extends Heap {
- //call super() and use the three data fields above
- //of course here I will add the abstract methods insert and delete
- //and code them according to the maxheap specifications
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement