Modified SelectSort.