39 lines
1.0 KiB
Markdown
39 lines
1.0 KiB
Markdown
|
---
|
||
|
date: 02.09.2024
|
||
|
type: mixed
|
||
|
---
|
||
|
|
||
|
|
||
|
## Sorting algorithms and their [complexity](Complexity.md)
|
||
|
|
||
|
| **Algorithm** | **Time Complexity** |
|
||
|
| ------------- | ------------------------------------------------------------- |
|
||
|
| Selection | $\mathcal{O}(n^2)$ |
|
||
|
| Insertion | $\mathcal{O}(n^2)$ |
|
||
|
| Bubble | $\mathcal{O}(n^2)$ |
|
||
|
| Quick | $\mathcal{O}(n^2)$ worst case, $\mathcal{O}(n\log n)$ average |
|
||
|
| Merge | $\mathcal{O}(n\log n)$ |
|
||
|
| Heap | $\mathcal{O}(n\log n)$ |
|
||
|
|
||
|
### Selection Sort
|
||
|

|
||
|

|
||
|
### Insertion sort
|
||
|

|
||
|
### Bubble sort
|
||
|
|
||
|

|
||
|
|
||
|
### Quick sort
|
||
|

|
||
|
|
||
|
|
||
|
### Merge sort
|
||
|
|
||
|

|
||
|
|
||
|
Cooler visual:
|
||
|

|
||
|
### Heap sort
|
||
|
|
||
|

|