Basic Sorting Algorithm
# Sorting Algorithms
Sorting Algorithm | Time Complex(Average) | Space Complex | isStable | isComplex |
---|---|---|---|---|
Insertion Sort | O(n^2) | O(1) | Stable | Simple |
Shell Sort | O(n^1.3) | O(1) | Unstable | Complex |
Bubble Sort | O(n^2) | O(1) | Stable | Simple |
Quick Sort | O(nlog2(n)) | O(log2(n)) | Unstable | Complex |
Selection Sort | O(n^2) | O(1) | Unstable | Complex |
Stack Sort | O(nlog2(n)) | O(1) | Unstable | Complex |
Merge Sort | O(nlog2(n)) | O(n) | Stable | Complex |
Radix Sort | O(d(n+r)) | O(r) | Stable | Complex |
::: tip | ||||
- Stable Algorithm: A sorting algorithm is stable if two objects with equal keys appear in the same order in sorted output as they appear in input array to be sorted. | ||||
- Complex Algorithm: A complex algorithm is defined as an algorithm that embodies mathematical or logical methods and requires at least one thousand lines of the C programming language to implement. Reference (opens new window) |
Updated: 2021/09/06, 21:27:01