selection sort consider the following depicted array as an example for the first position in the sorted listthe whole list is scanned sequentially the first position where is stored presentlywe search the whole list and find that is the lowest value so we replace with after one iteration which happens to be the minimum value in the listappears in the first position of the sorted list for the second positionwhere is residingwe start scanning the rest of the list in linear manner we find that is the second lowest value in the list and it should appear at the second place we swap these values after two iterationstwo least values are positioned at the beginning in sorted manner the same process is applied to the rest of the items in the array following is pictorial depiction of the entire sorting process