Skip to content

Conversation

lukmanu1
Copy link

@lukmanu1 lukmanu1 commented Oct 5, 2025

This PR adds a deterministic QuickSelect algorithm using the Median of Medians method in the divideandconquer package.

  • Fully static and final class
  • Finds the kth smallest element in O(n) worst-case time
  • Includes JavaDoc documentation
  • Includes JUnit 5 tests for multiple cases (duplicates, negatives, small arrays, invalid inputs)

Closes #6660

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
  • All new code is formatted with clang-format -i --style=file path/to/your/file.java

@codecov-commenter
Copy link

codecov-commenter commented Oct 5, 2025

Codecov Report

❌ Patch coverage is 93.18182% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.79%. Comparing base (9484c7e) to head (dff12ad).

Files with missing lines Patch % Lines
...s/divideandconquer/QuickSelectMedianOfMedians.java 93.18% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6661      +/-   ##
============================================
+ Coverage     75.75%   75.79%   +0.04%     
- Complexity     5772     5791      +19     
============================================
  Files           703      704       +1     
  Lines         19777    19821      +44     
  Branches       3832     3842      +10     
============================================
+ Hits          14982    15024      +42     
- Misses         4215     4216       +1     
- Partials        580      581       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

LUKMANul added 4 commits October 6, 2025 01:09
Updated imports in DeterministicQuickSelectTest.java to explicitly list JUnit methods, resolving the 'AvoidStarImport' Checkstyle rule. Also re-added the missing 'org.junit.jupiter.api.Test' import.
Adjusted the import order in DeterministicQuickSelectTest.java, placing regular imports before static imports, to satisfy the project's formatting and linting rules.
Removed trailing comments on import statements and ensured correct ordering (regular before static) in DeterministicQuickSelectTest.java to pass the project's formatting checks.
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.

[FEATURE REQUEST] Add Deterministic QuickSelect (Median of Medians) algorithm in divideandconquer package
2 participants