Skip to content

Conversation

Hirannya-Mhaisbadwe
Copy link

@Hirannya-Mhaisbadwe Hirannya-Mhaisbadwe commented Oct 4, 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

This PR adds an algorithm to find the middle of a singly linked list, along with unit tests.

Changes include:

  • FindMiddleOfSinglyLinkedList.java — implements slow/fast pointer technique to find the middle.
  • FindMiddleOfSinglyLinkedListTest.java — JUnit tests covering odd/even lists, single-node, two-node, empty list, and longer lists.

Motivation:

  • Finding the middle of a linked list is a common operation for merge sort, palindrome checks, and other list manipulations.
  • Adding this improves the completeness of the linked list module.

Fixes #6615

@codecov-commenter
Copy link

codecov-commenter commented Oct 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.70%. Comparing base (7e29be3) to head (e923c86).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6617      +/-   ##
============================================
+ Coverage     75.68%   75.70%   +0.02%     
- Complexity     5754     5755       +1     
============================================
  Files           699      699              
  Lines         19725    19725              
  Branches       3826     3826              
============================================
+ Hits          14929    14933       +4     
+ Misses         4216     4214       -2     
+ Partials        580      578       -2     

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

@Hirannya-Mhaisbadwe
Copy link
Author

Under Hacktober25

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.

Add "Find Middle of a Singly Linked List" Algorithm and Tests
2 participants