find the median without sorting