Skip to content

Conversation

@kanishkgits
Copy link

@kanishkgits kanishkgits commented Oct 6, 2024

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

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I ran below commands using the latest version of rust nightly.
  • I ran cargo clippy --all -- -D warnings just before my last commit and fixed any issue that was found.
  • I ran cargo fmt just before my last commit.
  • I ran cargo test just before my last commit and all tests passed.
  • I added my algorithm to the corresponding mod.rs file within its own folder, and in any parent folder(s).
  • I added my algorithm to DIRECTORY.md with the correct link.
  • I checked COUNTRIBUTING.md and my code follows its guidelines.

@codecov-commenter
Copy link

codecov-commenter commented Oct 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.33%. Comparing base (155c767) to head (0c50473).
Report is 1 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.



pub fn smooth_sort(nums: &mut Vec<i32>) {
let n = nums.len();
Copy link
Member

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?

@sozelfist
Copy link
Contributor

sozelfist commented Oct 7, 2024

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.

@kanishkgits kanishkgits closed this Oct 7, 2024
@kanishkgits
Copy link
Author

It's a complex algorithm and I was unable to pass the cargo test :(

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.

4 participants