Add LibrarySort Implementation#7481
Open
Rosander0 wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7481 +/- ##
============================================
+ Coverage 79.83% 79.85% +0.01%
- Complexity 7319 7328 +9
============================================
Files 805 806 +1
Lines 23785 23813 +28
Branches 4680 4687 +7
============================================
+ Hits 18989 19015 +26
Misses 4036 4036
- Partials 760 762 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
27b0040 to
1427328
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new LibrarySort implementation under com.thealgorithms.sorts, along with a dedicated JUnit test class to validate basic behavior.
Changes:
- Introduces
LibrarySortsorting implementation and API (LibrarySort.sort(int[])). - Adds
LibrarySortTestwith basic correctness and input-validation tests (including null input).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/main/java/com/thealgorithms/sorts/LibrarySort.java |
Adds the new sorting implementation and its Javadoc/API. |
src/test/java/com/thealgorithms/sorts/LibrarySortTest.java |
Adds unit tests covering common input shapes and null handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+4
to
+9
| /** | ||
| * Library Sort (also known as Gapped Insertion Sort) is a sorting algorithm | ||
| * that works like insertion sort but leaves gaps between elements to make | ||
| * future insertions faster. | ||
| * Time Complexity: O(n log n) average case | ||
| * Space Complexity: O(n) |
Comment on lines
+20
to
+25
| /** | ||
| * Sorts an array using the Library Sort algorithm. | ||
| * | ||
| * @param array the array to sort (must not be null) | ||
| * @return the sorted array | ||
| */ |
| */ | ||
| public static int[] sort(final int[] array) { | ||
| if (array == null) { | ||
| throw new IllegalArgumentException("Input array must not be null!"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
clang-format -i --style=file path/to/your/file.java