Algorithm name Steps Time Complexity
Bubble sort for(int i = 0 ; i < length-1; ++i){
    for(int j = 1; j < (length-i)-1; ++j){
        if( a[j] < a[j-1] ){
            swap(a[i], a[j]);
        }
    }
}
O(n^2)
For small lists like 4-5 items.
Not applicable for large number of items.
Easy to implement.
Insertion sort
Shell sort
Merge sort
Heap sort
Quick sort
Radix sort O(n*k) where
n - number of items,
k - length of key

Hosted by www.Geocities.ws

1