Skip to content

feat(datastructures): add SelfOrganizingLinkedList implementation and tests - #7575

Open
iamcodinghere22 wants to merge 20 commits into
TheAlgorithms:masterfrom
iamcodinghere22:feat/self-organizing-list
Open

feat(datastructures): add SelfOrganizingLinkedList implementation and tests#7575
iamcodinghere22 wants to merge 20 commits into
TheAlgorithms:masterfrom
iamcodinghere22:feat/self-organizing-list

Conversation

@iamcodinghere22

Copy link
Copy Markdown
Contributor

This PR implements the Self-Organizing Linked List data structure using the "Move To Front(MTF)" heuristic.
In this implementation, whenever an element is accessed/searched, it is dynamically moved to the head of the list. This optimizes access time for frequently requested items by keeping them near the front, achieving an {O(1)} best-case lookup time for repeated accesses.

Changes Included

  • Added SelfOrganizingLinkedList.java under com.thealgorithms.datastructures.lists.
  • Added comprehensive unit test coverage in SelfOrganizingLinkedListTest.java verifying search, insertion, edge cases (empty list, non-existent elements), and move-to-front behavior.

Testing

  • All unit tests in SelfOrganizingLinkedListTest.java pass locally (mvn test -Dtest=SelfOrganizingLinkedListTest).
  • Verified full build and test suite run successfully with JaCoCo code coverage.

Checklist

  • Code follows project coding guidelines.
  • Unit tests have been added for new functionality.
  • No duplicate code or classes introduced.

@codecov-commenter

codecov-commenter commented Aug 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.28571% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.61%. Comparing base (56e2699) to head (67df287).

Files with missing lines Patch % Lines
...datastructures/lists/SelfOrganizingLinkedList.java 94.28% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7575      +/-   ##
============================================
+ Coverage     80.59%   80.61%   +0.01%     
- Complexity     7483     7495      +12     
============================================
  Files           815      816       +1     
  Lines         24060    24095      +35     
  Branches       4736     4741       +5     
============================================
+ Hits          19390    19423      +33     
- Misses         3907     3909       +2     
  Partials        763      763              

☔ View full report in Codecov by Harness.
📢 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.

@iamcodinghere22

Copy link
Copy Markdown
Contributor Author

Hi @DenizAltunkapan @yanglbme @alxkm,
All checks have passed successfully and the branch is ready.
Could one of you please review and approve this PR so it can be merged?
Thanks

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