passing in sorting algo as param