fixes issue in arrayIsOrdered test returning whatever last comparison yielded
implementation of selection sort