[Paper Review] Comparison of Bucket Sort and RADIX Sort
This paper empirically compares bucket sort and radix sort across six real-world input scenarios using up to 100 million integers. Results show bucket sort is faster in all cases but consumes significantly more memory, especially with large integer ranges, while radix sort maintains consistent performance across sorted and unsorted inputs and uses less memory in most configurations.
Bucket sort and RADIX sort are two well-known integer sorting algorithms. This paper measures empirically what is the time usage and memory consumption for different kinds of input sequences. The algorithms are compared both from a theoretical standpoint but also on how well they do in six different use cases using randomized sequences of numbers. The measurements provide data on how good they are in different real-life situations. It was found that bucket sort was faster than RADIX sort, but that bucket sort uses more memory in most cases. The sorting algorithms performed faster with smaller integers. The RADIX sort was not quicker with already sorted inputs, but the bucket sort was.
Motivation & Objective
- To evaluate the real-world performance of bucket sort and radix sort beyond theoretical time complexity.
- To identify which algorithm is more efficient in practical scenarios involving diverse input distributions.
- To measure time usage and memory consumption across different integer ranges and data patterns.
- To determine under which conditions each algorithm outperforms the other in practice.
- To provide empirical data for selecting the optimal integer sorting algorithm based on input characteristics.
Proposed method
- Implemented both bucket sort and radix sort in C++ using the least significant digit (LSD) approach for radix sort and insertion sort for bucket sorting.
- Generated six distinct input sequences: uniform random, fully sorted, nearly sorted (95% sorted), small-range, large-range, and high-frequency repeated values.
- Measured execution time and memory usage on a standard laptop with Intel i5 using GNU/Linux, scaling input size from 1M to 100M integers.
- Used logarithmic scaling in visualizations to compare growth rates of time and memory usage across input types.
- Benchmarked algorithms on identical hardware and OS to ensure fair comparison.
- Collected data across three input sizes (10^6, 10^7, 10^8) to assess scalability and performance trends.
Experimental results
Research questions
- RQ1How do bucket sort and radix sort perform in terms of execution time across diverse real-world input distributions?
- RQ2What is the memory consumption trade-off between bucket sort and radix sort under different input conditions?
- RQ3Does radix sort maintain consistent performance on sorted versus unsorted inputs, as predicted by theory?
- RQ4How do integer range size and data distribution affect the performance of both algorithms?
- RQ5Under what input conditions does bucket sort outperform radix sort in practice, and vice versa?
Key findings
- Bucket sort was faster than radix sort in all six test cases, with execution times ranging from 0.31s to 97.43s for n=10^8.
- Radix sort showed consistent performance on both sorted and unsorted inputs, with execution times of 1.88s and 1.86s for n=10^7 in input cases 2 and 3, respectively.
- Bucket sort used significantly more memory than radix sort in most cases, with peak memory usage of 2344MB for input case 5, compared to 39MB for radix sort.
- For small integer ranges (input case 4), both algorithms performed well, but radix sort was faster (1.05s vs 0.31s for n=10^6), though bucket sort improved with smaller ranges.
- With large integer ranges (input case 5, M=10^8), both algorithms slowed down, but radix sort was particularly affected due to increased digit count (d), with execution time reaching 246.28s for n=10^8.
- In the high-frequency input case (input 6), both algorithms performed similarly to the uniform distribution case, indicating robustness to repeated values.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.