You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/counting-sort.md
+34-1Lines changed: 34 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,4 +4,37 @@ title: Counting sort
4
4
sidebar_label: Counting sort
5
5
---
6
6
7
-
[Open a pull request](https://github.com/AllAlgorithms/algorithms/tree/master/docs/counting-sort.md) to add the content for this algorithm.
7
+
Counting sort is an algorithm for sorting a collection of objects according to keys that are small integers; that is, it is an integer sorting algorithm. It operates by counting the number of objects that have each distinct key value, and using arithmetic on those counts to determine the positions of each key value in the output sequence. Its running time is linear in the number of items and the difference between the maximum and minimum key values, so it is only suitable for direct use in situations where the variation in keys is not significantly greater than the number of items.
| <imgsrc="https://cdn.abranhe.com/projects/algorithms/logos/cpp.svg"width="30px"> | C++ |[counting_sort.py](https://github.com/AllAlgorithms/cpp/blob/master/sorting/counting_sort.cpp)|
0 commit comments