Exchange sort Exchange sort is sometimes confused with bubble sort, although the algorithms are in fact distinct. Exchange sort works by comparing the first element with all elements above it, swapping where needed, thereby guaranteeing that the first element is correct for the final sort order; it then proceeds to do the same for the second element, and so on. It lacks the advantage that bubble sort has of detecting in one pass if the list is already sorted, but it can be faster than bubble sort by a constant factor (one less pass over the data to be sorted; half as many total comparisons) in worst-case situations. Like any simple O(n2) sort it can be reasonably fast over very small data sets, though in general insertion sort will be faster.
exchange sort exchange sort is sometimes confused with bubble sort although the algorithms are in fact distinct exchange sort works by comparing the first element with all elements above it swapping where needed thereby guaranteeing that the first element is correct for the final sort order; it then proceeds to do the same for the second element and so on it lacks the advantage that bubble sort has of detecting in one pass if the list is already sorted but it can be faster than bubble sort by a constant factor (one less pass over the data to be sorted; half as many total comparisons) in worst-case situations like any simple o(n2) sort it can be reasonably fast over very small data sets though in general insertion sort will be faster