(n)sorting algorithman algorithm for sorting a list