-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Adding smoothsort #808
Adding smoothsort #808
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #808 +/- ##
==========================================
- Coverage 95.33% 95.33% -0.01%
==========================================
Files 310 310
Lines 22518 22493 -25
==========================================
- Hits 21468 21443 -25
Misses 1050 1050 ☔ View full report in Codecov by Sentry. |
|
||
|
||
pub fn smooth_sort(nums: &mut Vec<i32>) { | ||
let n = nums.len(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not to use nums.len()
directly?
Please solve all the issues related to fmt, and clippy and make sure all the tests passed. Please read the CONTRIBUTING guideline before submit the PR. |
It's a complex algorithm and I was unable to pass the cargo test :( |
Description
Smoothsort is a sorting algorithm that efficiently handles partially sorted data, using specialized heaps (Leonardo heaps) to optimize performance. It’s in-place, with a best-case time complexity of O(n).
Some helpful articles:
Wikipedia: https://en.wikipedia.org/wiki/Smoothsort
GeeksforGeeks: https://www.geeksforgeeks.org/introduction-to-smooth-sort
Type of change
Checklist:
cargo clippy --all -- -D warnings
just before my last commit and fixed any issue that was found.cargo fmt
just before my last commit.cargo test
just before my last commit and all tests passed.mod.rs
file within its own folder, and in any parent folder(s).DIRECTORY.md
with the correct link.COUNTRIBUTING.md
and my code follows its guidelines.