Add median sort and quick select implementation