Sort a stack in ascending order