Selection sorting in array