Skip to content

Conversation

Ganesh-PC018
Copy link

@Ganesh-PC018 Ganesh-PC018 commented Oct 6, 2025

Description

This PR adds the implementation of Complex Number Multiplication under the com.thealgorithms.strings package.

The algorithm multiplies two complex numbers represented as strings (e.g., "1+1i" × "1+1i") and returns their product as a string.

Formula used:
(a + bi) * (c + di) = (ac - bd) + (ad + bc)i


Type of change

  • New Algorithm
  • Bug fix
  • Refactor
  • Documentation update

Checklist

  • I have read the Contributing Guidelines
  • The file is in the correct package (com.thealgorithms.strings)
  • Code is well-formatted and follows naming conventions
  • Added Javadoc comments for all methods and classes
  • Code passes all test cases
  • I have manually verified example cases:
    • Input: "1+1i", "1+1i" → Output: "0+2i"
    • Input: "1+-1i", "1+-1i" → Output: "0+-2i"

Additional context

This implementation uses constant time and space complexity (O(1)), relying purely on arithmetic parsing without using any external libraries.

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.68%. Comparing base (9484c7e) to head (a04649a).

Files with missing lines Patch % Lines
.../java/com/thealgorithms/strings/RemovingStars.java 0.00% 10 Missing ⚠️
...lgorithms/strings/ComplexNumberMultiplication.java 0.00% 9 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6675      +/-   ##
============================================
- Coverage     75.75%   75.68%   -0.08%     
  Complexity     5772     5772              
============================================
  Files           703      705       +2     
  Lines         19777    19796      +19     
  Branches       3832     3835       +3     
============================================
  Hits          14982    14982              
- Misses         4215     4234      +19     
  Partials        580      580              

☔ 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.

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.

2 participants