Another blog:

It is easier to write an incorrect program than understand a correct one.

Monday, April 18, 2011

Counting sort

# To fast sort millions integers with known range:

counting sort.

Counting sort (sometimes referred to as ultra sort or math sort) is a sorting algorithm which (like bucket sort) takes advantage of knowing the range of the numbers in the array to be sorted (array A).

Counting sort is a stable sort and has a running time of Θ(n+k), where n and k are the lengths of the arrays A (the input array) and C (the counting array), respectively. In order for this algorithm to be efficient, k must not be much larger than n.


♥ ¸¸.•*¨*•♫♪♪♫•*¨*•.¸¸♥

1 comment: