feat(sorts): Add Radix Sort algorithm #1
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a TypeScript implementation of the Radix Sort algorithm.
Radix Sort is a fundamental, non-comparison based integer sorting algorithm that was missing from the existing collection. Its inclusion provides a more comprehensive set of sorting algorithms in the repository, showcasing a different sorting paradigm from comparison-based sorts like Quick Sort or Merge Sort.
This implementation uses the LSD (Least Significant Digit) method and is designed as a pure function—it does not mutate the original input array but instead returns a new, sorted array. The code is fully typed and includes JSDoc comments for clarity.
Related Issue
N/A
Type of Change
Please delete options that are not relevant.
[x] New feature (non-breaking change which adds functionality)
How Has This Been Tested?
The algorithm has been tested locally with a variety of integer arrays, including empty arrays, arrays with negative numbers (if applicable), and arrays with duplicate values. A corresponding test file (radix_sort.test.ts) has been added to the test suite to ensure its correctness and prevent future regressions.
(Note: Be sure to actually create and include this test file in your PR.)
Checklist:
[x] My code follows the style guidelines of this project.
[x] I have performed a self-review of my own code.
[x] I have commented my code, particularly in hard-to-understand areas, using JSDoc.
[x] My changes generate no new warnings or linting errors.
[x] I have added tests that prove my feature works.
[x] New and existing unit tests pass locally with my changes.