
Isaac W. answered 12/04/20
Tutor for Computer Science at UH
Technically selection sort will always be the same or faster than bubble sort. This is due to the slower nature of bubble sort, bubble sort in some instances will take more iterations to move the same data to a more sorted position, whereas selection sort will always have part of the array sorted instantly.
for example.
selection
6 5 7 3 9
3 5 7 6 9
3 5 7 6 9
3 5 6 7 9
bubble
6 5 7 3 9
5 6 7 3 9
5 6 3 7 9
5 3 6 7 9
3 5 6 7 9
see how long it took to move the 3 to the 0th index in bubble sort?
it is inefficient and lazy compared to selection sort, which is why selection sort finished 1 iteration earlier than bubble in this instance, and could finish at the same time in other cases, however selection sort will NEVER be slower than bubble sort.