Skip to content

Add Duval's Lyndon factorization algorithm - #7639

Merged
alxkm merged 5 commits into
TheAlgorithms:masterfrom
vedant0517:contrib/lyndon-factorization
Oct 10, 2026
Merged

alxkm merged 5 commits into
TheAlgorithms:masterfrom
vedant0517:contrib/lyndon-factorization

Conversation

@vedant0517

Copy link
Copy Markdown
Contributor

Description

Implements Duval's algorithm for Lyndon factorization and adds unit tests.

Related Issue

Closes #7638

Changes

  • Added LyndonFactorization.factorize(String)
  • Added JUnit tests for:
    • Repeated patterns
    • Single-character input
    • Empty input
    • Null input
  • Added an algorithm reference in the source documentation.

Verification

The implementation was reviewed against the issue requirements and the repository contribution guidelines.

The implementation includes corresponding JUnit tests for the main functionality and edge cases.

Notes

This contribution adds a missing string algorithm to the repository using Duval's algorithm with O(n) time complexity and O(1) auxiliary working space, excluding the returned factors.

@codecov-commenter

codecov-commenter commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.18%. Comparing base (5eb9d66) to head (e5dc516).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7639      +/-   ##
============================================
- Coverage     82.18%   82.18%   -0.01%     
- Complexity     8363     8369       +6     
============================================
  Files           841      842       +1     
  Lines         26074    26093      +19     
  Branches       5086     5090       +4     
============================================
+ Hits          21429    21444      +15     
- Misses         3857     3858       +1     
- Partials        788      791       +3     

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

@vedant0517
vedant0517 marked this pull request as ready for review October 9, 2026 14:17

@alxkm alxkm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good. Thank you for the contribution.

@alxkm
alxkm merged commit e43ec38 into TheAlgorithms:master Oct 10, 2026
7 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.

[FEATURE REQUEST] Add Duval's algorithm for Lyndon factorization

3 participants