Median calculation of a vector of T.

I think this algorithm (nth_element) does not work in gcc 4.8.3, if I remember correctly Mahmoud had to use a work around for this in routing.