Implementation of selection sort algorithm