Efficient computation of generalized median estimators