## counting sort

31 examples (0.02 sec)
• Info In computer science, 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. more...
• Counting sort is used to determine the size of each bin and their starting index.
• The sorting can be done in linear time by the counting sort and hash table look up can be done in constant time.
• Like counting sort, this is an efficient variant if there are many duplicate values.
• Radix sort, such as two pass method where counting sort is used during the first pass of each level of recursion, has a large constant overhead.
• Counting sort is applicable when each input is known to belong to a particular set, S, of possibilities.
• See the counting sort and pigeonhole sort articles.
• For more restricted data, such as numbers in a fixed interval, distribution sorts such as counting sort or radix sort are widely used.
• It is common for the counting sort algorithm to be used internally by the radix sort.
• The following code in C is based on the counting sort algorithm provided in Cormen et al, with some improvements concerning memory allocation.
• In the top level of recursion, opportunity for parallelism is in the Counting sort portion of the algorithm.
• The sort in step 2 is usually done using bucket sort or counting sort, which are efficient in this case since there are usually only a small number of digits.
• The complexity of the algorithm is quasi-linear because sorting edges is possible in linear time via counting sort.
• The classical integer sorting algorithms of bucket sort, counting sort, and radix sort are widely used and practical.
• Another variant of bucket sort known as histogram sort or counting sort adds an initial pass that counts the number of elements that will fall into each bucket using a count array.
• As described, counting sort is not an in-place algorithm; even disregarding the count array, it needs separate input and output arrays.
• Bucket sort can be seen as a generalization of counting sort; in fact, if each bucket has size 1 then bucket sort degenerates to counting sort.
• The simplicity of the counting sort algorithm and its use of the easily parallelizable prefix sum primitive also make it usable in more fine-grained parallel algorithms.
• Seward developed the radix sort and counting sort algorithms in 1954 at MIT.
• However, despite their ease of computation, prefix sums are a useful primitive in certain algorithms such as counting sort, and they form the basis of the scan higher-order function in functional programming languages.
• The mechanism underlying bead sort is similar to that behind counting sort; the number of beads on each pole corresponds to the number of elements with value equal or greater than the index of that pole.