Skip to content

Conversation

Priyanshu1303d
Copy link
Contributor

@Priyanshu1303d Priyanshu1303d commented Oct 5, 2025

Hello! This PR adds the Haversine formula algorithm and also includes two small fixes for issues I found while setting up the development environment.

This implementation is of the Haversine formula to calculate the distance between two points on a sphere


New Feature: Haversine Formula

  • Added the Haversine formula implementation (Haversine.java) to the geometry package. This algorithm calculates the great-circle distance between two points on a sphere using their latitude and longitude.
  • Included a corresponding unit test file (HaversineTest.java) with multiple test cases to ensure correctness.

Build and Bug Fixes

To get the project to build and run tests successfully, I also made the following corrections:

  1. pom.xml: Updated the Maven compiler plugin configuration from <source>/<target> to the modern <release> tag. This resolves a build warning that was treated as an error when using newer JDKs.
  2. PartitionProblem.java: Corrected a Javadoc formatting error where the comment was placed before the package declaration, which caused a build failure due to the -Werror flag.

All tests pass successfully with these changes. Let me know if any further modifications are needed!

@codecov-commenter
Copy link

codecov-commenter commented Oct 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.75%. Comparing base (e6cb96f) to head (397bfdd).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6650      +/-   ##
============================================
+ Coverage     75.74%   75.75%   +0.01%     
- Complexity     5771     5773       +2     
============================================
  Files           702      703       +1     
  Lines         19770    19777       +7     
  Branches       3832     3832              
============================================
+ Hits          14975    14983       +8     
  Misses         4215     4215              
+ Partials        580      579       -1     

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

@Priyanshu1303d Priyanshu1303d force-pushed the feat/Haversine_Formula branch 2 times, most recently from adfc73f to 02a23a8 Compare October 5, 2025 12:35
@Priyanshu1303d Priyanshu1303d force-pushed the feat/Haversine_Formula branch from 02a23a8 to 397bfdd Compare October 5, 2025 12:46
Copy link
Member

@alxkm alxkm left a comment

Choose a reason for hiding this comment

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

Looks good. Thank for the contribution.

@alxkm alxkm merged commit 9484c7e into TheAlgorithms:master Oct 5, 2025
6 checks passed
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