mirror of
https://github.com/trekhleb/javascript-algorithms.git
synced 2025-07-05 00:23:59 +08:00
Add big O sheet for sorting algorithms.
This commit is contained in:
@ -90,11 +90,12 @@ Below is the list of some of the most used Big O notations and their performance
|
||||

|
||||
Source: [Big O Cheat Sheet](http://bigocheatsheet.com/).
|
||||
|
||||
### Array Sorting Algorithms
|
||||
### Array Sorting Algorithms Complexity
|
||||
|
||||

|
||||
Source: [Big O Cheat Sheet](http://bigocheatsheet.com/).
|
||||
|
||||
| Name | Best | Average | Worst | Memory | Stable | Method | Notes |
|
||||
| ------------------| :-----: | :-------: | :-----: | :-------: | :-------: | :------------ | :-------------- |
|
||||
| **Bubble sort** | n | n^2 | n^2 | 1 | Yes | Exchanging | Tiny code size. |
|
||||
| Name | Best | Average | Worst | Memory | Stable | Method | Notes |
|
||||
| --------------------- | :-----: | :-------: | :-----: | :-------: | :-------: | :------------ | :-------------- |
|
||||
| **Bubble sort** | n | n^2 | n^2 | 1 | Yes | Exchanging | Tiny code size |
|
||||
| **Selection sort** | n^2 | n^2 | n^2 | 1 | No | Selection | Stable with O(n) extra space, for example using lists |
|
||||
|
Reference in New Issue
Block a user