selection sort algorithm time and space complexity