Skip to content

refactor: cleanup CountingSort #5275

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

Closed
wants to merge 15 commits into from
Closed

refactor: cleanup CountingSort #5275

wants to merge 15 commits into from

Conversation

alxkm
Copy link
Contributor

@alxkm alxkm commented Jul 3, 2024

Cleanup CountingSort
Adding test for it

Extracted method CountingSort using stream into separate class also added test for it

  • 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 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 40.52%. Comparing base (f83bb65) to head (4d7e8b5).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5275      +/-   ##
============================================
+ Coverage     40.34%   40.52%   +0.18%     
- Complexity     2486     2500      +14     
============================================
  Files           519      521       +2     
  Lines         15479    15483       +4     
  Branches       2950     2954       +4     
============================================
+ Hits           6245     6275      +30     
+ Misses         8944     8916      -28     
- Partials        290      292       +2     

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

@alxkm alxkm requested a review from vil02 July 5, 2024 18:45
@alxkm alxkm requested a review from vil02 July 5, 2024 20:47
@alxkm
Copy link
Contributor Author

alxkm commented Jul 9, 2024

Hello @vil02 . Could you please advise on how to handle the Pseudo Counting Sort classes? To preserve the integrity and original purpose of this repository, it might be best to remove them since they do not actually implement Counting Sort. However, they have been part of the repository for some time, and I'm unsure of the best course of action.

@vil02
Copy link
Member

vil02 commented Jul 11, 2024

@alxkm: I would suggest to remove them. I would guess, the original implementation was merged by accident. Introducing some QuasiPseudoAlmostCountingSort does not make much sense: it does not have any special properties.

Therefore I suggest to:

  • remove these classes (with this PR, or close this one and open a new one; from documentation point of view the second option is better),
  • implement a proper CountingSort (i.e. only nonnegative integers as an input) in a new PR.

In any case: thanks to you we have spotted a quite serious bug!

@alxkm
Copy link
Contributor Author

alxkm commented Jul 11, 2024

@alxkm: I would suggest to remove them. I would guess, the original implementation was merged by accident. Introducing some QuasiPseudoAlmostCountingSort does not make much sense: it does not have any special properties.

Therefore I suggest to:

  • remove these classes (with this PR, or close this one and open a new one; from documentation point of view the second option is better),
  • implement a proper CountingSort (i.e. only nonnegative integers as an input) in a new PR.

In any case: thanks to you we have spotted a quite serious bug!

Ok, thank you. Got it. This is really proper way to resolve this issue

@alxkm
Copy link
Contributor Author

alxkm commented Jul 11, 2024

This implementation of CountingSort is wrong. Because it works only using TreeMap, which causes wrong asymptotic for CountingSort.

This issue will be resolved in such way:

  • Removing existed Counting sort in separate PR
  • Add correct implementation for Counting Sort (this is already exist in this pull request)

All these discussed in this PR

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