Skip to content
7 changes: 7 additions & 0 deletions src/algorithms/sorting/bubble-sort/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ are needed, which indicates that the list is sorted.

![Algorithm Visualization](https://upload.wikimedia.org/wikipedia/commons/c/c8/Bubble-sort-example-300px.gif)

## Complexity

###### time: worst _O_(_n_<sup>2</sup>), best _O_(_n_), average _O_(_n_<sup>2</sup>)

###### space: worst _O_(1) auxiliary


## References

- [Wikipedia](https://en.wikipedia.org/wiki/Bubble_sort)
Expand Down
6 changes: 6 additions & 0 deletions src/algorithms/sorting/counting-sort/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ zero.

![Counting Sort](https://1.bp.blogspot.com/-xPqylngqASY/WLGq3p9n9vI/AAAAAAAAAHM/JHdtXAkJY8wYzDMBXxqarjmhpPhM0u8MACLcB/s1600/ResultArrayCS.gif)

## 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_)

## References

- [Wikipedia](https://en.wikipedia.org/wiki/Counting_sort)
Expand Down
6 changes: 6 additions & 0 deletions src/algorithms/sorting/heap-sort/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ rather than a linear-time search to find the maximum.

![Algorithm Visualization](https://upload.wikimedia.org/wikipedia/commons/4/4d/Heapsort-example.gif)

## Complexity

###### time: worst _O_(_n log n_), best _O_(_n log n_), average _O_(_n log n_)

###### space: worst _O_(1) auxiliary

## References

[Wikipedia](https://en.wikipedia.org/wiki/Heapsort)
7 changes: 7 additions & 0 deletions src/algorithms/sorting/insertion-sort/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ sort.

![Algorithm Visualization](https://upload.wikimedia.org/wikipedia/commons/0/0f/Insertion-sort-example-300px.gif)

## Complexity

###### time: worst _O_(_n_<sup>2</sup>), best _O_(_n_), average _O_(_n_<sup>2</sup>)

###### space: worst _O_(1) auxiliary


## References

[Wikipedia](https://en.wikipedia.org/wiki/Insertion_sort)
6 changes: 6 additions & 0 deletions src/algorithms/sorting/merge-sort/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ emulate merge sort (top-down).

![Merge Sort](https://upload.wikimedia.org/wikipedia/commons/e/e6/Merge_sort_algorithm_diagram.svg)

## Complexity

###### time: average _O_(_n log n_)

###### space: worst _O_(_n_)

## References

- [Wikipedia](https://en.wikipedia.org/wiki/Merge_sort)
Expand Down
6 changes: 6 additions & 0 deletions src/algorithms/sorting/quick-sort/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ The horizontal lines are pivot values.

![Quicksort](https://upload.wikimedia.org/wikipedia/commons/6/6a/Sorting_quicksort_anim.gif)

## Complexity

###### time: worst _O_(_n_<sup>2</sup>), best _O_(_n log n_), average _O_(_n log n_)

###### space: worst _O_(_n_) auxiliary

## References

- [Wikipedia](https://en.wikipedia.org/wiki/Quicksort)
Expand Down
6 changes: 6 additions & 0 deletions src/algorithms/sorting/radix-sort/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ comparison-based sorts (and worse if keys are much longer than `log n`).

![Radix Sort](https://www.researchgate.net/publication/291086231/figure/fig1/AS:614214452404240@1523451545568/Simplistic-illustration-of-the-steps-performed-in-a-radix-sort-In-this-example-the.png)

## Complexity

###### time: worst _O_(_n_), best _O_(_n_), average _O_(_n_)

###### space: always _O_(_n_)

## References

- [Wikipedia](https://en.wikipedia.org/wiki/Radix_sort)
Expand Down
6 changes: 6 additions & 0 deletions src/algorithms/sorting/selection-sort/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ memory is limited.

![Algorithm Visualization](https://upload.wikimedia.org/wikipedia/commons/9/94/Selection-Sort-Animation.gif)

## Complexity

###### time: worst _O_(_n_<sup>2</sup>), best _O_(_n_<sup>2</sup>), average _O_(_n_<sup>2</sup>)

###### space: _O_(1) auxiliary

## References

[Wikipedia](https://en.wikipedia.org/wiki/Selection_sort)
6 changes: 6 additions & 0 deletions src/algorithms/sorting/shell-sort/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ Shell sort uses insertion sort to sort the array.

![Shellsort](https://www.tutorialspoint.com/data_structures_algorithms/images/shell_sort.jpg)

## Complexity

###### time: best _O_(_n log n_), average - depends on 'gap sequence'.

###### space: worst _O_(_n_) total, _O_(1) auxiliary

## References

* [Tutorials Point](https://www.tutorialspoint.com/data_structures_algorithms/shell_sort_algorithm.htm)
Expand Down