Computes the median of an array of values.