What is a sorting algorithm?