Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #24: Implement Radix Sort #35

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Brad-Edwards
Copy link
Collaborator

This PR implements the radix sort algorithm with the following features:

  • Implementation for non-negative integers (u32)
  • O(d * (n + b)) time complexity where d is number of digits and b is base (10)
  • O(n + b) auxiliary space
  • Stable sorting algorithm
  • Uses counting sort as a subroutine for each digit
  • Comprehensive documentation
  • Extensive unit tests covering:
    • Empty and single-element arrays
    • Already sorted arrays
    • Reverse sorted arrays
    • Random order arrays
    • Arrays with duplicates
    • Large arrays
    • Arrays with all equal elements
    • Numbers with different digit lengths
    • Powers of ten
    • Repeated digits
    • Single digit numbers
    • Stability verification
    • Digit extraction verification
    • Zero and large values

Key advantages:

  • Linear time complexity for fixed number of digits
  • Stable sorting
  • Works well when digit range is small
  • Can be faster than comparison-based sorts

Limitations:

  • Only works with integers
  • Performance depends on number of digits
  • Uses extra space proportional to input size

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants