To sort the elements of the array using selection sort