The following illustrates how different algorithms sort by tracking their comparisons.
Bubble sort is a sorting algorithm that repeatedly swaps adjacent elements that are out of order. At the i-th pass the last i elements are already sorted.
Selection sort is a sorting algorithm that finds the smallest element in the list and swaps it with the first element. At the i-th pass the first i elements are already sorted.
Insertion sort is a sorting algorithm that goes up a list, takes an element and goes back to insert it into the sorted portion of the list.
Shell sort is a variation of insertion sort with decreasing gaps until the entire list is sorted. When the gap is 1, it is equivalent to insertion sort.
Merge sort is a divide and conquer algorithm. It divides a list in two halves, repeats this for the two halves and then eventually merges the sorted halves.
Quick sort is a divide and conquer algorithm that selects a pivot then partitions the list into two parts based on if the pivot is less than or greater than the elements. It is equivalent to a binary search tree.