Implement stable selection sort algorithm.