package cop3530; public interface MedianHeap { Object findKth( int k ); boolean isEmpty( ); int getSize( ); void makeEmpty( ); Object removeKth( int k ); void insert( Object x ); } package cop3530; public class ArrayMedianHeap implements MedianHeap { ... public ArrayMedianHeap( java.util.Comparator c ) { items = new Object[ 5 ]; currentSize = 0; cmp = c; } public Object removeKth( int k ) { if( k < 1 || k > currentSize ) throw new IllegalArgumentException( ); Object kthItem = items[ k - 1 ]; for( int i = k; i < currentSize; i++ ) items[ i - 1 ] = items[ i ]; currentSize--; return kthItem; } private Object [ ] items; private int currentSize; private java.util.Comparator cmp; }