Update sort algorithm.