well, can be solved in O(1) time after O(m2) space and time preprocessing.Using a suffix trie, it can be solved in O(m) time after preprocessing of O(m2) time and space.
However, we want to solve the problem in O(1) for each question.
So our next idea is to construct a two-dimensional look-up table
For a string of length m , since the number of the factor is O(m2), the size of such table becomes O(m4).
Therefore we need O(m4) time and space preprocessing.
we gave a new solution, which solves the factor concatenation problem in O(1) time after O(m2) time and space preprocessing.
Answered by
Romi
, an ibibo Master,
at
10:17 AM on July 09, 2008