A linear-time median-finding algorithm for projecting a vector on the simplex of Rn