Quickly sorts a list of items based on a series of comparisons.