feat(strings): add Kasai's algorithm for LCP array construction#7324
Merged
alxkm merged 2 commits intoTheAlgorithms:masterfrom Mar 18, 2026
Merged
feat(strings): add Kasai's algorithm for LCP array construction#7324alxkm merged 2 commits intoTheAlgorithms:masterfrom
alxkm merged 2 commits intoTheAlgorithms:masterfrom
Conversation
Implement Kasai's algorithm to compute the Longest Common Prefix (LCP) array in O(N) time given a string and its suffix array. Add KasaiAlgorithm.java and KasaiAlgorithmTest.java.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7324 +/- ##
============================================
+ Coverage 79.43% 79.46% +0.03%
- Complexity 7062 7077 +15
============================================
Files 788 789 +1
Lines 23124 23150 +26
Branches 4545 4553 +8
============================================
+ Hits 18368 18396 +28
+ Misses 4022 4021 -1
+ Partials 734 733 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
alxkm
approved these changes
Mar 18, 2026
Member
alxkm
left a comment
There was a problem hiding this comment.
Looks good. Thank you for the contribution.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds an implementation of Kasai's Algorithm to the
stringsdirectory. The algorithm constructs the Longest Common Prefix (LCP) array from a provided string and its Suffix Array in O(N) time complexity. This perfectly complements the existing SuffixArray.java implementation.A comprehensive JUnit 5 test suite (KasaiAlgorithmTest.java) has also been included to validate various standard and edge cases. I have also verified that clang-format is completely satisfied.
clang-format -i --style=file path/to/your/file.java