use median of three pivot instead of random pivot for better performance