Skip to content

Artemis: Refactor and Optimize Mathematical Functions in Double Class#33

Open
mike-turintech wants to merge 1 commit intomainfrom
artemis-e1ebb793-bc31-4c24-8e7a-81712f149949
Open

Artemis: Refactor and Optimize Mathematical Functions in Double Class#33
mike-turintech wants to merge 1 commit intomainfrom
artemis-e1ebb793-bc31-4c24-8e7a-81712f149949

Conversation

@mike-turintech
Copy link
Copy Markdown
Member

This pull request introduces optimizations and refactoring to the mathematical functions in the Double class, enhancing performance and clarity. Key changes include:

  1. Optimized sumSquare Method: Reduced time complexity from O(n^2) to O(n) by eliminating nested loops.
  2. Refined sumTriangle Method: Simplified triangular number calculation and improved efficiency by removing inner loops.
  3. Revised countPairs Method: Replaced nested loops with a HashMap for counting duplicates, improving performance from O(n^2) to O(n).
  4. Simplified countDuplicates Method: Enhanced readability by using a single loop to check for index equality.

These changes improve the performance and maintainability of the code, aligning with best practices for algorithm design.

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