mirror of
https://github.com/trekhleb/javascript-algorithms.git
synced 2025-07-05 16:36:41 +08:00
Update READMEs.
This commit is contained in:
11
README.md
11
README.md
@ -96,8 +96,9 @@ Source: [Big O Cheat Sheet](http://bigocheatsheet.com/).
|
||||

|
||||
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 |
|
||||
| **Insertion sort** | n | n^2 | n^2 | 1 | Yes | Insertion | O(n + d), in the worst case over sequences that have d inversions |
|
||||
| **Selection sort** | n^2 | n^2 | n^2 | 1 | No | Selection | Stable with O(n) extra space, for example using lists |
|
||||
| Name | Best | Average | Worst | Memory | Stable | Method | Notes |
|
||||
| --------------------- | :-------: | :-------: | :-------: | :-------: | :-------: | :------------ | :-------------- |
|
||||
| **Bubble sort** | n | n^2 | n^2 | 1 | Yes | Exchanging | Tiny code size |
|
||||
| **Insertion sort** | n | n^2 | n^2 | 1 | Yes | Insertion | O(n + d), in the worst case over sequences that have d inversions |
|
||||
| **Selection sort** | n^2 | n^2 | n^2 | 1 | No | Selection | Stable with O(n) extra space, for example using lists |
|
||||
| **Heap sort** | n log(n) | n log(n) | n log(n) | 1 | No | Selection | |
|
||||
|
@ -8,3 +8,7 @@ The pass through the list is repeated until no swaps
|
||||
are needed, which indicates that the list is sorted.
|
||||
|
||||

|
||||
|
||||
## References
|
||||
|
||||
[Wikipedia](https://en.wikipedia.org/wiki/Bubble_sort)
|
||||
|
@ -10,3 +10,6 @@ sort.
|
||||
|
||||

|
||||
|
||||
## References
|
||||
|
||||
[Wikipedia](https://en.wikipedia.org/wiki/Insertion_sort)
|
||||
|
@ -12,3 +12,7 @@ memory is limited.
|
||||

|
||||
|
||||

|
||||
|
||||
## References
|
||||
|
||||
[Wikipedia](https://en.wikipedia.org/wiki/Selection_sort)
|
||||
|
Reference in New Issue
Block a user