1
$\begingroup$

Here is my question:

Given a compressed suffix tree of string S and a substring T. I need to return all substrings of S that begins with the substring T sorted by lexicographic order.

My approach: I can traverse the suffix tree and find the edge / node which last letter of T is written on it. The subtree of this edge basically should be all the substrings of S beginning with the string T.

Am I right about this one? And How can I print all this subtree sorted?

Raphael
73.3k31 gold badges183 silver badges403 bronze badges
asked Jan 22, 2018 at 21:15
$\endgroup$

1 Answer 1

0
$\begingroup$

Yes, you are right. You need to consume the symbols of $T$ and all occurrences of it shall be in the sub-tree below the position you stopped.

Since the edges are stored in lexicographical order, you can perform a Depth-first to print all the substrings of $S$ starting with $T$ in lexicographical order.

Using this example from Wikipediaenter image description here

and assuming $T = A,ドル we would arrive at an internal node. Doing a DFS, we would have: $A\$,ドル $ANA\$,ドル $ANANA\$$.

answered Jan 23, 2018 at 0:59
$\endgroup$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.