Update READMEs.

This commit is contained in:
Oleksii Trekhleb 2018-04-13 17:02:24 +03:00
parent f3aa4a1264
commit db4a57b8da

View File

@ -96,9 +96,9 @@ Source: [Big O Cheat Sheet](http://bigocheatsheet.com/).
![Big O of sorting algoritms](https://github.com/trekhleb/javascript-algorithms/blob/master/assets/big-o-sorting-algorithms.png) ![Big O of sorting algoritms](https://github.com/trekhleb/javascript-algorithms/blob/master/assets/big-o-sorting-algorithms.png)
Source: [Big O Cheat Sheet](http://bigocheatsheet.com/). Source: [Big O Cheat Sheet](http://bigocheatsheet.com/).
| Name | Best | Average | Worst | Memory | Stable | Method | Notes | | Name | Best | Average | Worst | Memory | Stable | Method |
| --------------------- | :-------: | :-------: | :-------: | :-------: | :-------: | :------------ | :-------------- | | --------------------- | :-------: | :-------: | :-------: | :-------: | :-------: | :------------ |
| **Bubble sort** | n | n^2 | n^2 | 1 | Yes | Exchanging | Tiny code size | | **Bubble sort** | n | n^2 | n^2 | 1 | Yes | Exchanging |
| **Insertion sort** | n | n^2 | n^2 | 1 | Yes | Insertion | O(n + d), in the worst case over sequences that have d inversions | | **Insertion sort** | n | n^2 | n^2 | 1 | Yes | Insertion |
| **Selection sort** | n^2 | n^2 | n^2 | 1 | No | Selection | Stable with O(n) extra space, for example using lists | | **Selection sort** | n^2 | n^2 | n^2 | 1 | No | Selection |
| **Heap sort** | n log(n) | n log(n) | n log(n) | 1 | No | Selection | | | **Heap sort** | n log(n) | n log(n) | n log(n) | 1 | No | Selection |