The Cheroz Algorithm is a hybrid sorting algorithm that combines the strengths of Heap Sort and Insertion Sort to deliver efficient performance across various data distributions and sizes. Designed as both an educational and exploratory tool, it leverages the adaptability of Insertion Sort for smaller or nearly sorted arrays and the robustness of Heap Sort for larger datasets.
-
Adaptive Threshold
Dynamically switches between Heap Sort and Insertion Sort based on input size and distribution. -
Enhanced Sorting
Incorporates a modified version of Insertion Sort to efficiently handle partially sorted arrays. -
Versatile Performance
Performs well on random, sorted, and reverse-sorted datasets. -
Scalable Design
Handles arrays ranging from 100 to 1,000,000 elements with ease.
-
Heap Sort Phase
Creates an initial sorted structure for larger datasets using Heap Sort. -
Insertion Sort Phase
- Standard Insertion Sort for small, unsorted arrays.
- Enhanced Insertion Sort to identify and optimize sorted subsequences within larger arrays.
-
Threshold Switching
A calculated threshold determines the transition point between Heap Sort and Insertion Sort.
procedure HYBRIDSORT(arr)
n ← length of arr
threshold ← DETERMINE_THRESHOLD(n)
HEAPSORT(arr, 0, n - 1)
if n ≤ threshold then
INSERTION_SORT(arr, 0, n - 1)
else
ENHANCED_INSERTION_SORT(arr, 0, n - 1)
end if
end procedure
- A programming environment supporting C++ or Python for algorithm implementation.
- Test datasets (random, sorted, reverse-sorted arrays).
- Define the hybrid sorting function using the pseudocode provided.
- Generate datasets of varying sizes and distributions.
- Run the Cheroz Algorithm and compare its performance against standalone Heap Sort and Insertion Sort.
-
Random Arrays
Slower than Heap Sort but faster than Insertion Sort for larger datasets. -
Sorted Arrays
Comparable to Heap Sort, with slight improvements in recognizing order. -
Reverse-Sorted Arrays
Matches Heap Sort performance and outperforms Insertion Sort.
-
Execution Time
Marginal improvements compared to standard algorithms. -
Switching Overhead
Additional computational cost due to method transitions. -
Threshold Rigidness
Fixed thresholds may not suit all datasets.
- Optimize threshold determination to reduce overhead and improve flexibility.
- Explore other hybrid combinations or enhancements to further boost performance.
- Investigate domain-specific applications, such as database sorting.
Department of Computer Science
University of Science and Technology of Southern Philippines