package username.median; import java.util.Comparator; import java.util.Random; import java.util.Vector; public class Median { /** * Find the median value in a vector of size n. */ public static T median(Vector vec, Comparator c) { // STUB return vec.get(0); } // median(Vector vec) /** * Find the ith-smallest value in a vector. The ith-smallest * value is one for which there are i smaller values. * * @param vec * The vector * @param i * The "position" of the element to find. * @param c * A comparator used to determine ordering. * @return ith * The ith smallest value. * @pre * The vector contains at least one value. * No two values in the vector are equal. * @post * There are exactly i values for which * c.compare(vec.get(j),ith) < 0 */ public static T ithSmallest(Vector vec, int i, Comparator c) { // STUB return vec.get(0); } // ithSmallest } // class Median