Computer Science, asked by physics4717, 1 year ago

Difference between bubble sort and selection sort in c language

Answers

Answered by Kingvikraal
1
Both the bubble sort and selection sort algorithms have average case time complexities of O(n2), bubble sort is almost all time outperformed by the selection sort. This is due to the number of swaps needed by the two algorithms (bubble sorts needs more swaps). But due to the simplicity of bubble sort, its code size is very small. Stability is another difference in these two algorithms. A stable sorting algorithm, is a sorting algorithm that retains order of records if the list contains elements with an equal value. In that sense, selection sort is not a stable algorithm whereas bubble sort is a stable algorithm.
Similar questions