Factbites
 Where results make sense
About us   |   Why use us?   |   Reviews   |   PR   |   Contact us  

Topic: Counting sort


Related Topics

  
  Counting sort - Wikipedia, the free encyclopedia
Counting 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 stable (see sorting algorithm) 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.
Because counting sort uses key values as indexes into an array, it is not a comparison sort, allowing it to break the Ω(n log n) lower-bound on those sorts.
www.wikipedia.org /wiki/Counting_sort   (750 words)

  
 Counting sort - Wikipedia, the free encyclopedia
The counts stored in C can then be used to put the elements in A into their right position in the resulting sorted array.
Counting sort may for example be the best algorithm for sorting numbers whose range is between 0 and 100, but it is probably unsuitable for sorting a list of names alphabetically.
However counting sort can be used in radix sort to sort a list of numbers whose range is too large for counting sort to be suitable alone.
en.wikipedia.org /wiki/Counting_sort   (750 words)

  
 Encyclopedia: Counting sort   (Site not responding. Last check: 2007-10-08)
Bucket sort is a sort algorithm that works by partitioning an array into a finite number of buckets and then sorting each bucket.
The sort is usually implemented by scanning up from the bottom of an array until an element larger than the partition element is found, then scanning down from the top for an element smaller than the partition element, these two elements are then swapped.
For sorting really enormous amounts of data that completely dwarf system memory, even the index may need to be sorted using an algorithm or combination of algorithms designed to perform reasonably with virtual memory, i.e., to reduce the amount of swapping required.
www.nationmaster.com /encyclopedia/Counting-sort   (420 words)

  
 Radix Sort   (Site not responding. Last check: 2007-10-08)
Radix sort is one of the linear sorting algorithms for integers.
However, the process adopted by this sort method is somewhat counterintuitive, in the sense that the numbers are sorted on the least-significant digit first, followed by the second-least significant digit and so on till the most significant digit.
Counting Sort is a linear, or O(n) algorithm.
www.cse.iitk.ac.in /users/dsrkg/cs210/applets/sortingII/radixSort/radix.html   (404 words)

  
 [No title]
Counting sort is a little harder to understand than bucket sort, but if you're sorting an array, it takes less memory.
We don't sort every string during every pass of the second stage; instead, a string is included in a pass only if it has a character in the appropriate place.
Observe that BA precedes BAABA and CC precedes CCAAA because of the stability of the sort.
www.cs.berkeley.edu /~jrs/61bs04/lec/36   (1330 words)

  
 Section 9.2 Counting sort   (Site not responding. Last check: 2007-10-08)
Counting sort assumes that each of the n input elements is an integer in the range 1 to k, for some integer k.
In the code for counting sort, we assume that the input is an array A[1..n], and thus length[A] = n.
An important property of counting sort is that it is stable: numbers with the same value appear in the output array in the same order as they do in the input array.
www.cs.uml.edu /~skaminen/ALGO/sec92.html   (161 words)

  
 counting sort   (Site not responding. Last check: 2007-10-08)
Definition: A 2-pass sort algorithm that is efficient when the range of keys is small and there many duplicate keys.
The first pass counts the occurrences of each key in an auxiliary array, and then makes a running total so each auxiliary entry is the number of preceding keys.
Counting sort may be seen as a radix sort where the radix is chosen so that a single pass distributes each key value into its own bucket.
www.nist.gov /dads/HTML/countingsort.html   (187 words)

  
 Non-Comparison Sorting Algorithms
As we have mentioned, it can be proved that a sorting algorithm that involves comparing pairs of values can never have a worst-case time better than O(N log N), where N is the size of the array to be sorted.
There are two versions of counting sort, depending on whether the goal is simply to sort N integers, or to sort N integers each of which has some associated information to be carried along with it.
A sorting algorithm that preserves the original order of duplicate keys (e.g., for this example, that finishes with the pair (1, Anne) coming before the pair (1, Sandy)) is called a stable sort.
www.cs.wisc.edu /~hasti/cs367-common/notes/LINEAR-SORTS.html   (1603 words)

  
 An Evaluation of Sorting as a Supercomputer Benchmark
Stable counting sorts are important as building blocks for radix sorts, which are used for sorting integers that are too large to be sorted in a single application of a counting sort.
In cases such as an external sort where all the data is subsequently permuted and written to disk or in the implementation of a send-with-add permutation where memory collisions are summed, rebalancing the sequence is unnecessary.
All sorting algorithms are dependent on the size of their key since key size multiplied by the number of keys reflects the total amount of data that must be permuted, and counted or compared.
www.thearling.com /text/nasa/nasa.htm   (7535 words)

  
 More Sorts   (Site not responding. Last check: 2007-10-08)
The counting sort is not a comparison sort, meaning no comparisions are made between the elements.
To use the counting sort three arrays are needed, the original unsorted array, A, an array to keep temporary data, B, and one for the new sorted array, C. The sort first scans through the original array, keeping track in array B the number of times a number appears.
Bucket sort is used by dividing the interval from 0 up to 1 into equal parts, buckets, and then distributes the original array into the buckets.
www.programcpp.com /chapter19/19_2_1.html   (312 words)

  
 The Quick sort algorithm is given by:   (Site not responding. Last check: 2007-10-08)
Counting sort can sort n integers in the range from 1 to k in T(n) = O(n+k) = 2n + 2k for this problem.
Counting sort is a practical algorithm due to limited range of elements to be sorted
We can sort a set of n numbers by first building a binary search tree containing these numbers (using Tree_Insert repeatedly to insert the numbers one by one) and then printing the numbers by an in-order tree walk.
www.cs.utsa.edu /~sincovec/CS3343/Ex2Spring00ANS.htm   (1076 words)

  
 Analysis of Algorithms: Lecture 10   (Site not responding. Last check: 2007-10-08)
The version of counting sort presented in class is not stable; it can't even be applied to the case of sorting records.
Selection sort is stable if we make sure to only replace the current minimum element with one that is less than it, not less than or equal to it.
It is important that we use a stable sort so that the order of the first sort is preserved when there are duplicate characters in the second sort and so forth.
www.cs.utexas.edu /users/djimenez/utsa/cs3343/lecture10.html   (855 words)

  
 Sorting -- Getting it Straight
Note that comparison counting is a kind of address table sort; that is, the C array infers the position of each element in the sorted list, but no records are actually moved.
Distribution counting sort is stable: numbers with the same value appear in the output array in the same order as they were in the input array.
First we count the number of 0's, 1's, 2's,..., 9's in the units (least significant) digit of the data and accumulate the space needed to restore the as in distribution counting.
www.cs.fit.edu /~wds/classes/cse5081/Sort/sort/sort.html   (5028 words)

  
 [No title]
Counting Sort (average and worst case behavior O(n)) Considerations: If you have a long key or a small data set, ACM 347 will probably be fastest.
Counting Sort (average and worst case behavior O(n)) You forgot heap sort: average *and* worst case behaviour O(n log n), perfectly suited for linked list sorting (good for variable sized data).
The problem with these sorts is that it is extremely difficult to write an efficient, general-purpose radix sort, and even when you have, it still isn't faster than quicksort unless you have enormous arrays to sort.
www.math.niu.edu /~rusin/known-math/96/sort   (1008 words)

  
 Radix Sort Revisited   (Site not responding. Last check: 2007-10-08)
The Radix Sort is then a multipass sort, and the number of passes equals the number of radices in the input values.
The second pass will sort this list according to the first column (ie the MSB, our second radix) and since the sorting method is stable, the 3 numbers 0xAA, 0xAB and 0xAC which share the same MSB will be found in output in the same order as in input.
For example when sorting words instead of dwords, the two last passes are useless since all involved bytes are null – in other words, none of those two passes will change the order in which the list already is. The idea then, is to detect those pathological cases and take advantage of them.
www.codercorner.com /RadixSortRevisited.htm   (3330 words)

  
 Counting sort - Encyclopedia, History, Geography and Biography
Counting sort - Encyclopedia, History, Geography and Biography
This encyclopedia, history, geography and biography article about Counting sort contains research on
Counting sort, Characteristics of counting sort, Sample implementations, C, Java, References and Sort algorithms.
www.arikah.net /encyclopedia/Counting_sort   (762 words)

  
 Counting Sort Page   (Site not responding. Last check: 2007-10-08)
Counting Sort works by counting the occurrences of each data value.
Array C[ ] is used to count the occurrences of the data values
An important point to note is that Counting Sort is stable: All elements of the same value will appear in the same order in the output array array that they do in the input array.
users.cs.cf.ac.uk /C.L.Mumford/tristan/CountPage.html   (266 words)

  
 Counting Sort   (Site not responding. Last check: 2007-10-08)
Counting sort is a linear time sorting algorithm used to sort items when they belong to a fixed and finite set.
If the sorted set is to be stored in an array C, then for each e in A, taken in reverse order, C[B[e]] = e.
Also, note that it is a stable algorithm, meaning that ties are resolved by reporting those elements first which occur first.
www.cse.iitk.ac.in /users/dsrkg/cs210/applets/sortingII/countingSort/count.html   (146 words)

  
 CS504 Scribe Notes   (Site not responding. Last check: 2007-10-08)
Sort the numbers by digit (using a stable sort) from least significant digit to most significat digit.
PSEUDOCODE Radix Sort (A,d) For i=1 to d { use a stable sort to sort array A on digit i }
It is clear that the counting sort is a stable sort.
ace.cs.ohiou.edu /~juedes/cs404/scribe13/scribe13.html   (138 words)

  
 UMM CSci 2101 Problem sets, Fall 2004: PS5
Counting sort is an algorithm for sorting elements with integers keys, where all keys are in a known interval.
Modify the counting sort method so that the program doesn't exit when invalid keys are encountered.
Instead these elements are ignored during sorting, and the rest of the elements are sorted as usual.
cda.mrs.umn.edu /~elenam/2101_fall04/psets/ps5.html   (810 words)

  
 Howard Kaikow's Sort Performance Comparison program - Information
Sorting the String data as numbers requires the numbers to be padded and aligned.
Depending on the sample size, the order of the source data, the data type, and the sorting method, the time to do the sort may be from less than one millisecond to, nearly, forever.
Otherwise the sorted data needs to be moved from the Excel worksheet to the selected source and the timing component will not be 0.
www.mv.com /ipusers/standards/Sorting/SortPerformanceComparison-Info.html   (1655 words)

  
 Algorithm Efficiency
One thing is clear from the results: counting sort is much, much faster than either selection sort or insertion sort.
One mathematical consequence of this is that the run time of selection sort goes up by a factor of 4 whenever the size of the list doubles, and goes up by a factor of 25 when the size of the list increases by a factor of 5.
Quicksort can sort any data items that can be compared for relative order in a list, so it is much more useful than counting sort.
www.lawrence.edu /fast/greggj/CMSC150/051Efficiency/051Efficiency.html   (1407 words)

  
 histogram sort   (Site not responding. Last check: 2007-10-08)
The first pass counts the number of items for each bucket in an auxiliary array, and then makes a running total so each auxiliary entry is the number of preceding items.
A counting sort uses one bucket per key.
R is an approximate rank function to sort the data into n bins.
www.itl.nist.gov /div897/sqg/dads/HTML/histogramSort.html   (388 words)

  
 Radix Sort
Specifically, the list of names is first sorted according to the first letter of each names, that is, the names are arranged in 26 classes.
On the first pass entire numbers sort on the least significant digit and combine in a array.
Then on the second pass, the entire numbers are sorted again on the second least-significant digits and combine in a array and so on.
www.personal.kent.edu /~rmuhamma/Algorithms/MyAlgorithms/Sorting/radixSort.htm   (238 words)

  
 sort
quicksort, heapsort, Shell sort, comb sort, radix sort, bucket sort, insertion sort, selection sort, merge sort, counting sort, histogram sort, strand sort, J sort, shuffle sort, American flag sort, gnome sort, bubble sort, bidirectional bubble sort, treesort (1), adaptive heap sort, multikey Quicksort.
Note: Any sorting algorithm can be made stable by appending the original position to the key.
The term "sort" came to be used in Computer Science because the earliest automated ordering procedures used punched card machines, which classified cards by their holes, to implement radix sort.
www.nist.gov /dads/HTML/sort.html   (279 words)

  
 Read about Counting sort at WorldVillage Encyclopedia. Research Counting sort and learn about Counting sort here!   (Site not responding. Last check: 2007-10-08)
Research Counting sort and learn about Counting sort here!
If the minimum and maximum values of A are not known, an initial pass of the data will be necessary to find these (this pass will take time Θ(n)).
radix sort to sort a list of numbers whose range is too large for counting sort to be suitable alone.
encyclopedia.worldvillage.com /s/b/Counting_sort   (541 words)

  
 Computer Science 3 - Lab 5
In general it is the fastest sort available, however, in some cases when there are restrictions on the data that has to be sorted you can sort faster than quick sort.
While going through the array, count the number of occurrences of each integer between 0 and rangeSize-1 in the array that you created at the beginning of the algorithm (note that you can use the current number that you are counting as an index in the second array).
Once you have the sorts categorized by complexity, devise data configurations that exploit behavior that is unique to a given sort algorithm.
www.cs.rit.edu /~vcss233/Labs/lab05/writeup.html   (1999 words)

  
 C Board - sort+counting
In this case, the keys are characters, and ints (which count the number of occurences) are the values.
An entry is not created until it is accessed, and the map will initialize ints (as values) to 0, which is why this code maintains an accurate count.
05-30-2003, 02:15 PM well...if you know a way to count the number of occurrences of each letter in that string in alphabetical order without the need to kill the punctuations it is ok...
cboard.cprogramming.com /archive/index.php/t-40057.html   (1076 words)

Try your search on: Qwika (all wikis)

Factbites
  About us   |   Why use us?   |   Reviews   |   Press   |   Contact us  
Copyright © 2005-2007 www.factbites.com Usage implies agreement with terms.