Update READMEs.

This commit is contained in:
Oleksii Trekhleb
2018-06-22 15:34:32 +03:00
parent 5ac8bc98e7
commit 619c58ec87
9 changed files with 27 additions and 35 deletions

View File

@ -11,16 +11,9 @@ are needed, which indicates that the list is sorted.
## Complexity
Time
- worst _O_(_n_<sup>2</sup>),
- best _O_(_n_),
- average _O_(_n_<sup>2</sup>)
Space
worst _O_(1) auxiliary
| Name | Best | Average | Worst | Memory | Stable | Comments |
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
| **Bubble sort** | n | n<sup>2</sup> | n<sup>2</sup> | 1 | Yes | |
## References

View File

@ -56,9 +56,9 @@ zero.
## Complexity
###### time: worst _O_(_n_ + _k_), best _O_(_n_), average _O_(_n_ + _k_) where _n_ is the number of elements in the input array and _k_ is the range of the output.
###### space: worst _O_(_n_ + _k_)
| Name | Best | Average | Worst | Memory | Stable | Comments |
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
| **Counting sort** | n + r | n + r | n + r | n + r | Yes | r - biggest number in array |
## References

View File

@ -15,9 +15,9 @@ rather than a linear-time search to find the maximum.
## Complexity
###### time: worst _O_(_n log n_), best _O_(_n log n_), average _O_(_n log n_)
###### space: worst _O_(1) auxiliary
| Name | Best | Average | Worst | Memory | Stable | Comments |
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
| **Heap sort** | n&nbsp;log(n) | n&nbsp;log(n) | n&nbsp;log(n) | 1 | No | |
## References

View File

@ -12,10 +12,9 @@ sort.
## Complexity
###### time: worst _O_(_n_<sup>2</sup>), best _O_(_n_), average _O_(_n_<sup>2</sup>)
###### space: worst _O_(1) auxiliary
| Name | Best | Average | Worst | Memory | Stable | Comments |
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
| **Insertion sort** | n | n<sup>2</sup> | n<sup>2</sup> | 1 | Yes | |
## References

View File

@ -24,9 +24,9 @@ emulate merge sort (top-down).
## Complexity
###### time: average _O_(_n log n_)
###### space: worst _O_(_n_)
| Name | Best | Average | Worst | Memory | Stable | Comments |
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
| **Merge sort** | n&nbsp;log(n) | n&nbsp;log(n) | n&nbsp;log(n) | n | Yes | |
## References

View File

@ -25,9 +25,9 @@ The horizontal lines are pivot values.
## Complexity
###### time: worst _O_(_n_<sup>2</sup>), best _O_(_n log n_), average _O_(_n log n_)
###### space: worst _O_(_n_) auxiliary
| Name | Best | Average | Worst | Memory | Stable | Comments |
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
| **Quick sort** | n&nbsp;log(n) | n&nbsp;log(n) | n<sup>2</sup> | log(n) | No | |
## References

View File

@ -27,9 +27,9 @@ comparison-based sorts (and worse if keys are much longer than `log n`).
## Complexity
###### time: worst _O_(_n_), best _O_(_n_), average _O_(_n_)
###### space: always _O_(_n_)
| Name | Best | Average | Worst | Memory | Stable | Comments |
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
| **Radix sort** | n * k | n * k | n * k | n + k | Yes | k - length of longest key |
## References

View File

@ -15,9 +15,9 @@ memory is limited.
## Complexity
###### time: worst _O_(_n_<sup>2</sup>), best _O_(_n_<sup>2</sup>), average _O_(_n_<sup>2</sup>)
###### space: _O_(1) auxiliary
| Name | Best | Average | Worst | Memory | Stable | Comments |
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
| **Selection sort** | n<sup>2</sup> | n<sup>2</sup> | n<sup>2</sup> | 1 | No | |
## References

View File

@ -44,9 +44,9 @@ Shell sort uses insertion sort to sort the array.
## Complexity
###### time: best _O_(_n log n_), average - depends on 'gap sequence'.
###### space: worst _O_(_n_) total, _O_(1) auxiliary
| Name | Best | Average | Worst | Memory | Stable | Comments |
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
| **Shell sort** | n&nbsp;log(n) | depends on gap sequence | n&nbsp;(log(n))<sup>2</sup> | 1 | No | |
## References