Sort an unsorted stack