Skip to content

Conversation

@aishuarya
Copy link

@aishuarya aishuarya commented Jul 12, 2024

  • 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 Jul 12, 2024

Codecov Report

Attention: Patch coverage is 80.76923% with 5 lines in your changes missing coverage. Please review.

Project coverage is 40.74%. Comparing base (f1e2606) to head (4e3b94d).
Report is 28 commits behind head on master.

Files Patch % Lines
...c/main/java/com/thealgorithms/sorts/SleepSort.java 80.76% 5 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5285      +/-   ##
============================================
+ Coverage     40.67%   40.74%   +0.06%     
- Complexity     2502     2509       +7     
============================================
  Files           519      520       +1     
  Lines         15447    15473      +26     
  Branches       2949     2953       +4     
============================================
+ Hits           6283     6304      +21     
- Misses         8869     8874       +5     
  Partials        295      295              

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

@aishuarya aishuarya force-pushed the feature/sleepSort branch 8 times, most recently from 5e02a8b to 6e789ad Compare July 12, 2024 08:02
@aishuarya aishuarya force-pushed the feature/sleepSort branch from 6e789ad to 47f0a86 Compare July 12, 2024 08:04
@aishuarya aishuarya marked this pull request as ready for review July 12, 2024 08:06
for (int numbers : array) {
Thread thread = new Thread(() -> {
try {
Thread.sleep(numbers); // Sleep for 'num' milliseconds
Copy link
Member

Choose a reason for hiding this comment

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

Do you think it is a good idea to throw IllegalArgumentException, when any of the entries is negative?

@aishuarya aishuarya force-pushed the feature/sleepSort branch from 79e82d2 to 9091ad8 Compare July 13, 2024 02:46
@aishuarya aishuarya force-pushed the feature/sleepSort branch from 9091ad8 to bf2110c Compare July 13, 2024 02:50
@aishuarya
Copy link
Author

@vil02 Addressed you comments ! Thanks .

Copy link
Member

@vil02 vil02 left a comment

Choose a reason for hiding this comment

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

These are just some obvious remarks. I will provide more feedback, when I will have a bit more time.

Comment on lines +37 to +39
if (number < 0) {
throw new IllegalArgumentException("All numbers must be non-negative. Found: " + number);
}
Copy link
Member

Choose a reason for hiding this comment

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

This should happen, before starting any of the new threads.

List<Integer> sortedList = Collections.synchronizedList(new ArrayList<>());
List<Thread> threads = new ArrayList<>();

for (int number : array) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
for (int number : array) {
for (final int number : array) {

@aishuarya
Copy link
Author

@vil02 Addressed you comments .

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution!

@github-actions github-actions bot added the stale label Sep 15, 2024
@github-actions
Copy link

Please reopen this pull request once you have made the required changes. If you need help, feel free to ask in our Discord server or ping one of the maintainers here. Thank you for your contribution!

@github-actions github-actions bot closed this Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants