Closed
Conversation
some tests added
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #894 +/- ##
=======================================
Coverage 95.52% 95.52%
=======================================
Files 319 319
Lines 23014 23039 +25
=======================================
+ Hits 21984 22009 +25
Misses 1030 1030 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
Please ping one of the maintainers once you commit the changes requested or make improvements on the code. If this is not the case and you need some help, feel free to ask for help in our Gitter channel. Thank you for your contributions! |
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.
Sorting function
The file implements the bubble_sort function for sorting using the bubble sort algorithm.
The function takes a modifiable reference to a slice of elements and sorts it in ascending order.
If the array is empty, the function returns control immediately.
Inside the loop, the array is traversed, neighboring elements are compared, and if the current one is larger than the next, they are swapped.
If there were no permutations during the pass, the array is considered sorted and the loop is terminated.
After each complete pass, the range for the next iteration is decreased by 1 because the last element is already in its place.
Tests
The tests module implements tests for various cases:
For each test it is checked that the result is really sorted and contains the same elements as the initial array (using the auxiliary functions is_sorted and have_same_elements).