2

I have a fixed string S of size n on which I make a lot of substring queries. One way to optimise for this situation is to preprocess the string and build a suffix tree, or suffix array. After preprocessing, substring queries can be performed optimally on S.

Is there an easy way, in Python, to preprocess strings "out of the box", without having to manually write all the code to build a suffix tree or suffix array?

1 Answer 1

3

I believe that the emsre python package provides exactly what you are looking for.

Sign up to request clarification or add additional context in comments.

2 Comments

I'm playing around at interviewstreet.com
It would be nice to see an answer that does it without an assist from a (likely complex) library. Basically - is there a solution that we can grok in O(1) time

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.