Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list, compares
adjacent elements and swaps them if they are in the wrong order.
- Worst Complexity : N^2
- Average Complexity : N^2
- Best Complexity : N
- Space Complexity : 1
- Method : Exchanging
- Stable : Yes
Comb Sort is mainly an improvement over Bubble Sort. Bubble sort always compares adjacent values. So all inversions are removed
one by one. Comb Sort improves on Bubble Sort by using gap of size more than 1.
- Worst Complexity : N^2
-
Average Complexity : N * log(N)
- Best Complexity : N
- Space Complexity : 1
- Method : Exchanging
- Stable : No
Heap sort is a comparison based sorting technique based on Binary Heap data structure. It is similar to selection sort where we
first find the maximum element and place the maximum element at the end. We repeat the same process for remaining element.
-
Worst Complexity : N * log(N)
-
Average Complexity : N * log(N)
-
Best Complexity : N * log(N)
- Space Complexity : 1
- Method : Selection
- Stable : No
Insertion Sort is a simple sorting algorithm that builds the final sorted array one item at a time. It is much less efficient on
large lists than more advanced algorithms such as quicksort, heapsort, or merge sort.
- Worst Complexity : N ^ 2
-
Average Complexity : N ^ 2
- Best Complexity : N
- Space Complexity : 1
- Method : Insertion
- Stable : Yes
Selection Sort is a sorting algorithm, specifically an in-place comparison sort. It has O time complexity, making it inefficient
on large lists, and generally performs worse than the similar insertion sort
- Worst Complexity : N ^ 2
-
Average Complexity : N ^ 2
- Best Complexity : N ^ 2
- Space Complexity : 1
- Method : Selection
- Stable : No
Shell Sort is mainly a variation of Insertion Sort. In insertion sort, we move elements only one position ahead. When an element
has to be moved far ahead, many movements are involved. The idea of shellSort is to allow exchange of far items.
-
Worst Complexity : Depends on Gap Sequence
-
Average Complexity : N * log(N)^2 OR N ^ (3/2)
- Best Complexity : N
- Method : Insertion
- Stable : No