Changes selection sort to affect input array