Skip to content

dd Merge Sort Algorithm in Java #6280

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

Closed

Conversation

farheen-shaikh530
Copy link

This pull request adds a recursive implementation of the Merge Sort algorithm under Sorting/MergeSort.java.

What this PR includes:
• Full implementation of Merge Sort using the divide and conquer strategy
• Recursive method to split the array into halves
• Merging logic to combine sorted subarrays
• Sample input and output in the main() method
• Time complexity: O(n log n)

Why Merge Sort?
• Merge Sort is significantly faster than O(n²) algorithms like Bubble or Insertion Sort on larger datasets.
• It is stable and has consistent performance across input types.
• Demonstrates recursion, modular logic, and efficient array handling.

This contribution enhances the Sorting section of the repo with a mid-level, industry-relevant sorting algorithm.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.06%. Comparing base (7602f1e) to head (2c50872).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6280      +/-   ##
============================================
- Coverage     74.07%   74.06%   -0.01%     
+ Complexity     5351     5350       -1     
============================================
  Files           677      677              
  Lines         18648    18648              
  Branches       3621     3621              
============================================
- Hits          13813    13812       -1     
  Misses         4276     4276              
- Partials        559      560       +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.

@vil02
Copy link
Member

vil02 commented Jun 10, 2025

Same as in #6281 (comment).

@vil02 vil02 closed this Jun 10, 2025
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