Sort a stack.