Combining the Strengths of MergeSort & InsertionSort
In traditional sorting methods, MergeSort shines with its ability to efficiently handle large datasets. Conversely, InsertionSort boasts swiftness with smaller arrays, thanks to its minimal overhead compared to the recursive tendencies of MergeSort. This project taps into the advantages of both, involving:
- 🚀 Employing MergeSort for larger arrays.
- 🔀 Transitioning to InsertionSort when the array size is ≤ the preset threshold,
S
.
With this, we aim for a performance pinnacle, harnessing the best of both realms.
- 💡 Threshold-based Sorting: Seamlessly swaps between MergeSort and InsertionSort depending on data size.
- 📊 Optimized Performance: Striving to eclipse traditional MergeSort across various datasets.
- ⚙️ Customizable: Adapt the threshold to explore performance variations.
- 🟢 The array is recursively split (as in traditional MergeSort).
- 🔴 When the size of the split array is less than or equal to
S
, InsertionSort is employed for sorting. - 🔵 The sorted sub-arrays are subsequently merged back into one.