Skip to content

"feat: add suffix array+LCP and suffix automaton implementations"#79

Open
shashu8660 wants to merge 6 commits intoIamBisrutPyne:mainfrom
shashu8660:add-suffix-algorithm
Open

"feat: add suffix array+LCP and suffix automaton implementations"#79
shashu8660 wants to merge 6 commits intoIamBisrutPyne:mainfrom
shashu8660:add-suffix-algorithm

Conversation

@shashu8660
Copy link

Summary

Add two Java algorithms:

  1. Suffix Array + LCP (Doubling + Kasai) - algorithms/suffix-array/SuffixArrayLCP.java
  2. Suffix Automaton - algorithms/suffix-automaton/SuffixAutomaton.java

How to compile & run

javac algorithms/suffix-array/SuffixArrayLCP.java
java -cp algorithms/suffix-array SuffixArrayLCP "banana"

javac algorithms/suffix-automaton/SuffixAutomaton.java
java -cp algorithms/suffix-automaton SuffixAutomaton "ababa"

Complexity

  • Suffix Array (doubling): O(n log n) time, O(n) memory
  • LCP (Kasai): O(n) time
  • Suffix Automaton (construction): O(n) time, O(n) states on average

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.

1 participant