TOPIC 19.2.1
More Sorts


Radix Sort

Radix sort is a simple sort that is easy to understand, and to use. The radix sort is used to sort integers quickly. It does this by, sorting the numbers by the least digit, then the next least digit, and so on. If two of the digits are equal, the first integer must always stay before the second integer. An example is shown below.

Counting Sort

The counting sort used to sort an array intigers, with a know range from 1 to n. 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. Next, in array B the data is manipulated by starting in the first array posistion and adding it to the next array position, and continuing this process until the end of the array is reached. Now, the integer at the end of array A is used to find its position in array C, by indexing B with the last number in A to find the index in C. Once the integer has been placed into array C, the number in array B is reduced by one. This process continues until the beginning of array A is reached.

Bucket Sort

Bucket sort is used to sort floating point numbers that contain the values from 0 up to 1. For bucket sort the original array, A, and an array of link lists, B, will be needed. 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. The buckets are then sorted, and linked together to obtain the sorted list.