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

[OTHER]: Duplicate entry of sieve of eratosthenes #1666

Open
SpiderMath opened this issue May 22, 2024 · 19 comments
Open

[OTHER]: Duplicate entry of sieve of eratosthenes #1666

SpiderMath opened this issue May 22, 2024 · 19 comments
Labels
beginner-friendly Easy to implement chore General improvement

Comments

@SpiderMath
Copy link
Contributor

What would you like to share?

There's three entries in total for Sieve of Eratosthenes on the website, but the problem is that there's a primary one out of the three which has a majority of the implementations, including that of JS. However, there's another one which has just another JS implementation of the exact same thing, and it's named Sieve of Eratosthenes Int Array, which is both a weird name and just a random duplicate entry. Since it only had a JS entry, I wasn't sure if I should open an issue on the website repo or here, hence I thought as this was a JS repo issue I'd open it here.
So, do we remove the duplicate entry from the repository?

Additional information

No response

@SpiderMath SpiderMath added the awaiting triage Awaiting triage from a maintainer label May 22, 2024
@appgurueu
Copy link
Collaborator

I think we can get rid of https://github.com/TheAlgorithms/JavaScript/blob/master/Maths/SieveOfEratosthenesIntArray.js; it is strictly inferior to https://github.com/TheAlgorithms/JavaScript/blob/master/Maths/SieveOfEratosthenes.js (except perhaps for being a bit simpler, at the cost of being less optimized).

@appgurueu appgurueu added beginner-friendly Easy to implement chore General improvement and removed awaiting triage Awaiting triage from a maintainer labels May 23, 2024
@SpiderMath
Copy link
Contributor Author

Since you've added the beginner-friendly tag, do you wish to keep this issue open for any beginners to take it up or should I do it now and push the changes? (considering we only need to remove certain files)

@appgurueu
Copy link
Collaborator

Since you've added the beginner-friendly tag, do you wish to keep this issue open for any beginners to take it up or should I do it now and push the changes? (considering we only need to remove certain files)

Feel free to do it now

SpiderMath added a commit to SpiderMath/Javascript_TheAlgorithms that referenced this issue May 25, 2024
@AbhishekMane06
Copy link

There are three entries for the Sieve of Eratosthenes on the website, with one primary entry containing most implementations, including JavaScript. However, there's another entry named "Sieve of Eratosthenes Int Array," which is a duplicate with only a JavaScript implementation and a confusing name.

  • Remove the "Sieve of Eratosthenes Int Array" entry to avoid confusion and maintain consistency.
  • Ensure no unique features or references are lost in the process.

Please review and confirm if this is a suitable approach.

@PranjalShrivas
Copy link

PranjalShrivas commented Jul 14, 2024

There are two Sieve of Eratosthenes entries in the website ( I think they are duplicate ). It returns an array of boolean which tells the numbers are true or false.

There is another one Sieve of Eratosthenes Int Array it return the Array of numbers that are primes only and it doesn't contains any non prime numbers.

I think Sieve of Eratosthenes Int Array should not be removed, while out of two Sieve of Eratosthenes entries one should be removed because I think they are duplicate.
Please tell if I am in right direction.

@appgurueu appgurueu linked a pull request Jul 17, 2024 that will close this issue
@appgurueu
Copy link
Collaborator

As I said, I think removing the "Int Array" variant is fine. Then there is only one Sieve of Eratosthenes left.

@raklaptudirm
Copy link
Member

There is a pr with the necessary change, but they seem to have abandoned it without removing the related tests.

@shah0108
Copy link

shah0108 commented Oct 1, 2024

is this issue still on??

@appgurueu
Copy link
Collaborator

Yes.

@shah0108
Copy link

shah0108 commented Oct 2, 2024

i think i got the problem, we should remove one of the implementation right?
so can u tell me what user will actually require...like
https://the-algorithms.com/algorithm/sieve-of-eratosthenes-int-array
this will be required when the user wants all the prime number between a given range meanwhile
https://the-algorithms.com/algorithm/sieve-of-eratosthenes?lang=javascript
this will be required when user wants to check primality of numbers or generate prime status for boolean array .

and according to me user will definitely want 1st one more than the 2nd one...so we should remove the 2nd one...this is the problem right??

@appgurueu
Copy link
Collaborator

I think it doesn't matter much. Both variants can easily be turned into the other via postprocessing. I feel https://the-algorithms.com/algorithm/sieve-of-eratosthenes-int-array is a bit cleaner, whereas the other one might be a bit more optimized. But ultimately they both implement the core idea of the Sieve of Eratosthenes.

@shah0108
Copy link

shah0108 commented Oct 3, 2024

Thank you for your input! I agree that both implementations can achieve the same goal through post-processing, and it's great to have flexibility. However, from a user-experience standpoint, we should prioritize clarity and ease of use.
Most users will likely want a list of prime numbers (like in the int array implementation), which is simple and immediately useful for most practical applications. The boolean array implementation, while optimized, adds a layer of abstraction that users may not need unless they specifically want to check primality across a range of numbers.
So, for simplicity and to avoid confusion, I still think we should keep just one implementation, ideally https://the-algorithms.com/algorithm/sieve-of-eratosthenes-int-array. This way, we streamline the codebase and make it more user-friendly without compromising on functionality.

What do you think about this approach?

@shah0108
Copy link

shah0108 commented Oct 3, 2024

and can u tell me what you are also thinking specifically...i.e. to remove one of the two or just change the name or heading?

@appgurueu
Copy link
Collaborator

Remove one of the two, possibly rename it (if we're keeping the "int array" one, we would want to rename that to just "Sieve of Eratosthenes"), consolidate the tests.

@shah0108
Copy link

shah0108 commented Oct 5, 2024

Sounds good!
I agree with removing one of the implementations and renaming the remaining one to "Sieve of Eratosthenes" for clarity. I'll go ahead and:
->Remove the boolean array implementation.
->Rename the int array version to simply "Sieve of Eratosthenes."
->Consolidate the tests to ensure everything works smoothly.
I'll start working on this and submit a PR shortly. Let me know if there's anything else you'd like to add!?

@sanjogbhalla16
Copy link

I would love to contribute in this , if it open, it is my first time , can you please guide me.

@aynaash
Copy link

aynaash commented Oct 8, 2024

Hi if this is still open maybe I could work on it. I am a beginner.

@m3tal10
Copy link

m3tal10 commented Oct 10, 2024

Hey is this still available?

@AishwaryaTatiwar
Copy link

Hey!! please assign this to me if it's still available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginner-friendly Easy to implement chore General improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants