Search code examples
algorithmstring-matchingsuffix-tree

Why do we make clone for some nodes in Suffix Automata Algorithm?


I have been studying about Suffix Automata string matching algorithm for a few days. I watched these videos and reed documents but I really can't get why we need to make a new node (under special condition) and clone it. I know how it works now but I am eager to learn the reason behind it. What would be the problem if we keep previous nodes? for example in the picture below we have new node (red Circle) for 'b' character. Can some one explain it to me? Appreciate. enter image description here


Solution

  • There's no difference for your test case.

    Another test case abbcbb. Which node should string bb be belonging to?

    So clone a node is necessary to guarantee that the node corresponding to each substring is unique.