Dirty version of c++ quick_median.