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 ## Complexity
Time | Name | Best | Average | Worst | Memory | Stable | Comments |
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
- worst _O_(_n_<sup>2</sup>), | **Bubble sort** | n | n<sup>2</sup> | n<sup>2</sup> | 1 | Yes | |
- best _O_(_n_),
- average _O_(_n_<sup>2</sup>)
Space
worst _O_(1) auxiliary
## References ## References

View File

@ -56,9 +56,9 @@ zero.
## Complexity ## 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. | Name | Best | Average | Worst | Memory | Stable | Comments |
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
###### space: worst _O_(_n_ + _k_) | **Counting sort** | n + r | n + r | n + r | n + r | Yes | r - biggest number in array |
## References ## References

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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