Skip to content

Commit 619c58e

Browse files
committedJun 22, 2018
Update READMEs.
1 parent 5ac8bc9 commit 619c58e

File tree

9 files changed

+27
-35
lines changed

9 files changed

+27
-35
lines changed
 

‎src/algorithms/sorting/bubble-sort/README.md

+3-10
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,9 @@ are needed, which indicates that the list is sorted.
1111

1212
## Complexity
1313

14-
Time
15-
16-
- worst _O_(_n_<sup>2</sup>),
17-
- best _O_(_n_),
18-
- average _O_(_n_<sup>2</sup>)
19-
20-
Space
21-
22-
worst _O_(1) auxiliary
23-
14+
| Name | Best | Average | Worst | Memory | Stable | Comments |
15+
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
16+
| **Bubble sort** | n | n<sup>2</sup> | n<sup>2</sup> | 1 | Yes | |
2417

2518
## References
2619

‎src/algorithms/sorting/counting-sort/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ zero.
5656

5757
## Complexity
5858

59-
###### 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.
60-
61-
###### space: worst _O_(_n_ + _k_)
59+
| Name | Best | Average | Worst | Memory | Stable | Comments |
60+
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
61+
| **Counting sort** | n + r | n + r | n + r | n + r | Yes | r - biggest number in array |
6262

6363
## References
6464

‎src/algorithms/sorting/heap-sort/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ rather than a linear-time search to find the maximum.
1515

1616
## Complexity
1717

18-
###### time: worst _O_(_n log n_), best _O_(_n log n_), average _O_(_n log n_)
19-
20-
###### space: worst _O_(1) auxiliary
18+
| Name | Best | Average | Worst | Memory | Stable | Comments |
19+
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
20+
| **Heap sort** | n&nbsp;log(n) | n&nbsp;log(n) | n&nbsp;log(n) | 1 | No | |
2121

2222
## References
2323

‎src/algorithms/sorting/insertion-sort/README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ sort.
1212

1313
## Complexity
1414

15-
###### time: worst _O_(_n_<sup>2</sup>), best _O_(_n_), average _O_(_n_<sup>2</sup>)
16-
17-
###### space: worst _O_(1) auxiliary
18-
15+
| Name | Best | Average | Worst | Memory | Stable | Comments |
16+
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
17+
| **Insertion sort** | n | n<sup>2</sup> | n<sup>2</sup> | 1 | Yes | |
1918

2019
## References
2120

‎src/algorithms/sorting/merge-sort/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ emulate merge sort (top-down).
2424

2525
## Complexity
2626

27-
###### time: average _O_(_n log n_)
28-
29-
###### space: worst _O_(_n_)
27+
| Name | Best | Average | Worst | Memory | Stable | Comments |
28+
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
29+
| **Merge sort** | n&nbsp;log(n) | n&nbsp;log(n) | n&nbsp;log(n) | n | Yes | |
3030

3131
## References
3232

‎src/algorithms/sorting/quick-sort/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ The horizontal lines are pivot values.
2525

2626
## Complexity
2727

28-
###### time: worst _O_(_n_<sup>2</sup>), best _O_(_n log n_), average _O_(_n log n_)
29-
30-
###### space: worst _O_(_n_) auxiliary
28+
| Name | Best | Average | Worst | Memory | Stable | Comments |
29+
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
30+
| **Quick sort** | n&nbsp;log(n) | n&nbsp;log(n) | n<sup>2</sup> | log(n) | No | |
3131

3232
## References
3333

‎src/algorithms/sorting/radix-sort/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ comparison-based sorts (and worse if keys are much longer than `log n`).
2727

2828
## Complexity
2929

30-
###### time: worst _O_(_n_), best _O_(_n_), average _O_(_n_)
31-
32-
###### space: always _O_(_n_)
30+
| Name | Best | Average | Worst | Memory | Stable | Comments |
31+
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
32+
| **Radix sort** | n * k | n * k | n * k | n + k | Yes | k - length of longest key |
3333

3434
## References
3535

‎src/algorithms/sorting/selection-sort/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ memory is limited.
1515

1616
## Complexity
1717

18-
###### time: worst _O_(_n_<sup>2</sup>), best _O_(_n_<sup>2</sup>), average _O_(_n_<sup>2</sup>)
19-
20-
###### space: _O_(1) auxiliary
18+
| Name | Best | Average | Worst | Memory | Stable | Comments |
19+
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
20+
| **Selection sort** | n<sup>2</sup> | n<sup>2</sup> | n<sup>2</sup> | 1 | No | |
2121

2222
## References
2323

‎src/algorithms/sorting/shell-sort/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ Shell sort uses insertion sort to sort the array.
4444

4545
## Complexity
4646

47-
###### time: best _O_(_n log n_), average - depends on 'gap sequence'.
48-
49-
###### space: worst _O_(_n_) total, _O_(1) auxiliary
47+
| Name | Best | Average | Worst | Memory | Stable | Comments |
48+
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
49+
| **Shell sort** | n&nbsp;log(n) | depends on gap sequence | n&nbsp;(log(n))<sup>2</sup> | 1 | No | |
5050

5151
## References
5252

0 commit comments

Comments
 (0)
Please sign in to comment.