Sorts items by comparing with the specified compare function.
compare function to use to compare items