Logic
Studies show that the radix sort algorithm was first used in 1887 by Herman Hollerith to perform computations on tabulating machines. Dalton et al. claim that radix is a sorting algorithm that uses passes to sort numbers or integers instead of using the classical method of comparisons (25). Radix sort can use the bucket sort or bin sort logic. The logic of operation involves sorting a series of numbers repeatedly by utilizing the digital properties of numbers. The sorting process starts from the rightmost digit based on the key (string or word) or the positions of the numbers being sorted. Each key is determined by its base number representation. Because different pieces of keys are fixed in size, each key holds a fixed number of values. If R represents different possible values, then the sizes vary according to the series 0, 1, 2…, R-1. Typically, “the key can be defined as a radix-R number, with digits numbered from the left (starting at 0)” (Dalton et al. 26). It has been suggested that good hardware support provides an appropriate environment to implement the radix sort algorithm.
Reasoning
The radix sorting algorithm has two specific modes of operation. The first one involves examining the key with its corresponding digits in a left-to-right order. This technique is referred to as the most-significant-digit (MSD) radix sorts (Albutiu et al. 1065). Often, the MSD approach is the most preferred sorting technique. MSD sort optimizes the lexicographical order based on the minimum amount of information. The original order of the duplicate keys needs not be kept but it follows a sequence that begins with the most significant digit, which is followed by the left most digit before shifting to the least-most digit and gradually to the right most digit. The files can be sorted recursively by partitioning them into sub-files using the sorted digits.
LSD Radix Sort
The second method is the least significant digit (LSD) radix sorts. LSD radix sort works in the opposite way to MSD radix sort. LSD radix sorts the integers from the least to the most significant digit. With LSD, short keys are given a higher priority than long keys. By considering a typical example like “b, c, d, e, f, g, h, i, j, ba” characters, it lexicographically becomes “b, ba, c, d, e, f, g, h, i, j”. The original order of the keys is usually kept when using the LSD sorting technique. LSD is non-recursive while MSD is recursive. Besides, MSD consumes more memory than LSD.
For the LSDRadixSort(R) algorithm, suppose a set of input values is supplied consisting of R = , whose length is m in the alphabetical range of [0…α], the output occurs in the lexicographical order of the following pseudo code:
for l ← m − 1 to 0 do CountingSort(R, l)
Return R
Example: Suppose the original unsorted number is: 171, 45, 75, 92, 802, 2, 25, 66, using the least significant digit results in 171, 92, 802, 2, 25, 45, 75, 66, while noting that 802 has been kept because 802 comes before 2. If sorted by 10 digits, it comes to 802, 2, 25, 45, 66, 171, 75, 92, and if sorted by 100, it becomes 2, 25, 45, 66, 75, 92, 171, 802.
The time complexity of the above sorting algorithm is O (|R| + α). Here, CountingSort(R, l) sorts the strings identified in R. Often, the strings are similar in length, m for sorting short strings and integers can. To sort N distinct numbers where d= log N digits, the time taken to sort N is given by O (Size) = O (d N) = O (N log N), which does not conflict with theory. For a word of size z, the radix sort complexity is O (z n) for n keys that make integers of size z. However, for very large n, if z is taken as a constant, the performance increases further.
Pseudo code
Radix_SORT (A, d)
for i=1 to d
Stable_Sort (A) on digit i
Example
Consider the following array: A [10]
Pass 1
Pass 2
Pass 3
Applications
According to Dalton et al., the radix sorting algorithm was developed to sort large integers and perform parallel computing (27). A set of participants can use it to securely compute multi-party computation (MPC) protocols in sorting networks whose functions take the form of (y1… ym) = (x1,…,xm). Radix sort is used in computational molecular biology, plagiarism detection, and data compression because its data redundancy detection abilities. Comparisons are not used. Radix is a stable algorithm that works in linear constant sorting time and cannot be used on long sorting keys because it requires more sorting memory.
Works Cited
Albutiu, Martina-Cezara, et al. “Massively Parallel Sort-Merge Joins in Main Memory Multi-Core Database Systems.” Proceedings of the VLDB Endowment, vol. 10, no. 5, 2012, pp. 1064-1075.
Dalton, Steven, et al. “Optimizing Sparse Matrix—Matrix Multiplication For The Gpu.” ACM Transactions on Mathematical Software (TOMS), vol. 4, no. 41, 2015, pp. 25-35.