Skip to content
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 DarkSort Algorithm #6141

Merged
merged 8 commits into from
Jan 18, 2025
Merged

Conversation

sahilkumarvalecha
Copy link
Contributor

This pull request adds the DarkSort algorithm, a randomized sorting algorithm based on the quicksort strategy. The algorithm divides the array around a pivot element, recursively sorts the partitions, and leverages randomization for efficiency. It offers an average-case time complexity of O(n log n) and is useful in scenarios requiring fast sorting with large data sets.

  • 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 Jan 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.83%. Comparing base (466ff0b) to head (755196f).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6141      +/-   ##
============================================
+ Coverage     73.80%   73.83%   +0.03%     
- Complexity     5144     5153       +9     
============================================
  Files           660      661       +1     
  Lines         17669    17687      +18     
  Branches       3404     3409       +5     
============================================
+ Hits          13041    13060      +19     
+ Misses         4120     4119       -1     
  Partials        508      508              

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

@sahilkumarvalecha sahilkumarvalecha marked this pull request as ready for review January 16, 2025 10:02
Copy link
Member

@siriak siriak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide more details

src/main/java/com/thealgorithms/sorts/DarkSort.java Outdated Show resolved Hide resolved
@sahilkumarvalecha
Copy link
Contributor Author

Hi Andrii Siriak
apologies for the confusion earlier dark sort does not deal with strings it only sorts integer based data and is efficient than many other algorithms let me know if you need any further details on this

Copy link
Member

@siriak siriak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the implementation is much more reasonable, I only have onecomment about public interface

@sahilkumarvalecha
Copy link
Contributor Author

hi I have made changes and now it only accepts integers

Copy link
Member

@siriak siriak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@siriak siriak enabled auto-merge (squash) January 18, 2025 17:34
@siriak siriak merged commit 5454e2f into TheAlgorithms:master Jan 18, 2025
6 checks passed
@sahilkumarvalecha
Copy link
Contributor Author

thanks a lot this was my first open source contribution <3 many to come.

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.

3 participants