Skip to content

Conversation

SwarritSrivastava
Copy link

@SwarritSrivastava SwarritSrivastava commented Oct 6, 2025

  • 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

What does this PR do?

Adds two new string algorithms:

  1. RemoveStars

    • Removes each '*' and its closest non-star character to the left.
    • Example: "abbc**def*g" → "abdeg"
  2. ComplexNumberMultiplication

    • Multiplies two complex numbers represented as strings.
    • Example: "1+1i" * "1+1i" → "0+2i"

Checklist

  • Added Javadoc comments
  • Added JUnit tests
  • Code passes Checkstyle, PMD, and SpotBugs
  • Verified locally with mvn clean verify

This is my contribution for Hacktoberfest 2025

@codecov-commenter
Copy link

codecov-commenter commented Oct 6, 2025

Codecov Report

❌ Patch coverage is 62.79070% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.42%. Comparing base (b1aa896) to head (2f43688).

Files with missing lines Patch % Lines
...rithms/datastructures/bloomfilter/BloomFilter.java 20.00% 8 Missing and 8 partials ⚠️
Additional details and impacted files
@@ Coverage Diff @@ ## master #6678 +/- ## ============================================ - Coverage 76.45% 76.42% -0.04%  - Complexity 5985 5992 +7  ============================================ Files 716 718 +2 Lines 20265 20307 +42 Branches 3929 3940 +11 ============================================ + Hits 15494 15519 +25  - Misses 4180 4189 +9  - Partials 591 599 +8 

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
@SwarritSrivastava SwarritSrivastava marked this pull request as ready for review October 6, 2025 12:43
@SwarritSrivastava SwarritSrivastava marked this pull request as draft October 7, 2025 07:38
@SwarritSrivastava SwarritSrivastava changed the title Added RemoveStars and ComplexNumberMultiplication Added RemoveStars and ComplexNumberMultiplication Label:enhancement Oct 7, 2025
@SwarritSrivastava SwarritSrivastava changed the title Added RemoveStars and ComplexNumberMultiplication Label:enhancement Fixed Type conversion error in BloomFilter.java Added RemoveStars and ComplexNumberMultiplication Oct 7, 2025
@SwarritSrivastava SwarritSrivastava marked this pull request as ready for review October 7, 2025 07:41
@SwarritSrivastava SwarritSrivastava marked this pull request as draft October 7, 2025 07:44
@SwarritSrivastava SwarritSrivastava marked this pull request as ready for review October 7, 2025 07:44
Copy link
Member

@DenizAltunkapan DenizAltunkapan left a comment

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Are all these if-else branches really necessary?

You’re manually handling every primitive array type here (byte[], int[], double[], etc.), but this can be simplified. Java’s reflection API allows a more concise and general approach — you can check key.getClass().isArray() and then use either Arrays.toString((Object) key) for primitive arrays or Arrays.deepToString((Object[]) key) for object arrays.

Copy link
Member

Choose a reason for hiding this comment

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

Wouldn’t this class be a better fit for the math package?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants