Fixed selection sort

Fixed error in selection sort. Still need to implement tests.