Skip to content

Add Duval's Lyndon factorization algorithm - #7639

Draft
vedant0517 wants to merge 2 commits into
TheAlgorithms:masterfrom
vedant0517:contrib/lyndon-factorization
Draft

vedant0517 wants to merge 2 commits into
TheAlgorithms:masterfrom
vedant0517:contrib/lyndon-factorization

Conversation

@vedant0517

Copy link
Copy Markdown

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.

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

1 participant