public static <E extends Comparable<E>> E kthSmallest(E[] array, int k) {
		if (array == null || k >= array.length || k < 0)
			return null;
		
		MaxHeap<E> maxheap = new MaxHeap<E>();
		
		for (E e : array) {
			if (maxheap.size() < k + 1)
				maxheap.add(e);
			else if (e.compareTo(maxheap.findMax()) < 0) {
				maxheap.deleteMax();
				maxheap.add(e);
			}
		}
		
		return maxheap.findMax();
	}