Bubble sort algorithm is N^2/2 comparisons, N^2/4 swaps. runs in O(N^2) time.
selection sort algorithm is O(N^2) comparisons, O(N) swaps. runs in O(N^2) time
insertion sort algorithm is O(N^2) comparisons, runs in O(N^2) time. runs twice as fast as the bubble sort and faster than the selection sort.
If the data is almost sorted, insertion sort runs in almost O(N) time. which makes it a simple and efficient way to order a file that is only slightly out of order.